Bug Tracker

Opened 7 years ago

Closed 7 years ago

#11664 closed bug (invalid)

append don't correcty works

Reported by: dav.p@… Owned by: dav.p@…
Priority: low Milestone: None
Component: manipulation Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:

Description

My html: <table></table>

$('table').append($('<tr><td>correct</td></tr><script>alert("Ok");</script>'));

Correctly insert html and eval Script

But:

$('table').append($('<script>alert("Ok");</script><tr><td>correct</td></tr>'));

Eval script but insert only the text "correct" but non html tags

Change History (2)

comment:1 Changed 7 years ago by sindresorhus

Component: unfiledmanipulation
Owner: set to dav.p@…
Priority: undecidedlow
Status: newpending

Works for me in Chrome 18. Please post a jsfiddle testcase as mentioned in the red box. Also include which browsers you're experiencing the problem with.

comment:2 Changed 7 years ago by mikesherov

Resolution: invalid
Status: pendingclosed

Script is not a valid child element of table:

http://dev.w3.org/html5/spec-author-view/the-table-element.html#the-table-element

It's a miracle this ever worked at all. You should fix your code to append the script separately and not inside an element it doesn't belong.

Note: See TracTickets for help on using tickets.