Skip to main content

Bug Tracker

Side navigation

#14844 closed bug (duplicate)

Opened March 04, 2014 10:01AM UTC

Closed April 28, 2014 07:56PM UTC

buildFragment process "script" element error

Reported by: wwwppp0801@gmail.com 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,">");}</script>',true);

output:

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

the RegExp was massed

Attachments (0)
Change History (3)

Changed March 06, 2014 03:46AM UTC by wwwppp0801@gmail.com comment:1

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

Changed April 28, 2014 03:13PM UTC by dmethvin comment:2

component: unfiledcore
milestone: None1.12/2.2
priority: undecidedlow
status: newopen

Regex. Ugh.

Changed April 28, 2014 07:56PM UTC by gibson042 comment:3

resolution: → duplicate
status: openclosed

Duplicate of #14329.Related: #14228