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
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