Bug Tracker

Opened 10 years ago

Closed 9 years ago

#14844 closed bug (duplicate)

buildFragment process "script" element error

Reported by: wwwppp0801@… Owned by:
Priority: low Milestone: 1.12/2.2
Component: core Version: 1.11.0
Keywords: Cc:
Blocked by: Blocking:

Description

i use jquery to insert an html, which contains "script" element.

the javascript code in the element is replaced, cause syntax error.

$.parseHTML('<script>if("100<b.length"){String(u).replace(/>/g,"&gt;");}</script>',true);

output:

if("100<b.length"){String(u).replace(></b>/g,"&gt;");}

the RegExp was massed

Change History (3)

comment:1 Changed 10 years ago by wwwppp0801@…

var a="%3Cscript%3Evar%20u%3D%22%3Ch1%3Eabcde%3C%2Fh1%3E%22%3Bif(%22100%3Cu.length%22)%7Bu.replace(%2F%3E%2Fg%2C%22%26gt%3B%22)%3B%7D%3C%2Fscript%3E"; a=decodeURIComponent(a); alert(a); alert(decodeURIComponent('%3Cscript%3E')+$(a).html()+decodeURIComponent("%3C%2Fscript%3E"));

these code should alert 2 same code, but not

comment:2 Changed 9 years ago by dmethvin

Component: unfiledcore
Milestone: None1.12/2.2
Priority: undecidedlow
Status: newopen

Regex. Ugh.

comment:3 Changed 9 years ago by gibson042

Resolution: duplicate
Status: openclosed

Duplicate of #14329.
Related: #14228

Note: See TracTickets for help on using tickets.