Skip to main content

Bug Tracker

Side navigation

#11664 closed bug (invalid)

Opened April 27, 2012 11:10AM UTC

Closed April 27, 2012 01:24PM UTC

append don't correcty works

Reported by: dav.p@tiscali.it Owned by: dav.p@tiscali.it
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

Attachments (0)
Change History (2)

Changed April 27, 2012 11:16AM UTC by sindresorhus comment:1

component: unfiledmanipulation
owner: → dav.p@tiscali.it
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.

Changed April 27, 2012 01:24PM UTC by mikesherov comment:2

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.