Side navigation
#11677 closed bug (invalid)
Opened May 01, 2012 02:17PM UTC
Closed May 01, 2012 06:06PM UTC
$(replacingHtml).find("[data-replaced='true']").length is 0. but it is exist.
Reported by: | thulasiram.eee@gmail.com | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | selector | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
var replacingHtml = "<tr colspan='15'><table width='100%' height='350' data-replaced='true' data-rep='" + product_id + "'><tr><th class='system_header'>Financier name</th><th class='system_header'>Address</th><th class='system_header'>Contact number</th><th class='system_header'>Fax number</th><th class='system_header'>Email</th><th class='system_header'>Region</th></tr></table></tr>";
alert($(replacingHtml).find("[data-replaced='true']").length);
Attachments (0)
Change History (3)
Changed May 01, 2012 02:27PM UTC by comment:1
Changed May 01, 2012 04:03PM UTC by comment:2
I'm pretty sure that's not valid HTML
http://www.w3.org/TR/html401/struct/tables.html#h-11.2.5
If you console.log the element that results from that HTML, it doesn't contain the table element since it's not valid which is why it doesn't find the data-replaced attribute on it.
Changed May 01, 2012 06:06PM UTC by comment:3
component: | unfiled → selector |
---|---|
priority: | undecided → low |
resolution: | → invalid |
status: | new → closed |
As anonymous said, not valid HTML. If you console.log() it, it will output:
<tr> <th class="system_header">Financier name</th> <th class="system_header">Address</th> <th class="system_header">Contact number</th> <th class="system_header">Fax number</th> <th class="system_header">Email</th> <th class="system_header">Region</th> </tr>
http://jsfiddle.net/nanoquantumtech/j8Q3C/
var replacingHtml = "<tr colspan='15'><table width='100%' height='350' data-replaced='true' data-rep='" + product_id + "'><tr><th class='system_header'>Financier name</th><th class='system_header'>Address</th><th class='system_header'>Contact number</th><th class='system_header'>Fax number</th><th class='system_header'>Email</th><th class='system_header'>Region</th></tr></table></tr>";
alert($(replacingHtml).find("[data-replaced='true']").length);
http://jsfiddle.net/nanoquantumtech/j8Q3C/