Opened 11 years ago
Closed 11 years ago
#11677 closed bug (invalid)
$(replacingHtml).find("[data-replaced='true']").length is 0. but it is exist.
Reported by: | 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);
Change History (3)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
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.
comment:3 Changed 11 years ago by
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/