<script>for(var i=0;i<n;i++);</script>
Outputs:
START TAG: 'script'
CHARACTERS: 'for(var i=0;i'
START TAG: 'n;i++);<' attributes:
'script' = ''
Essentially everything inside a <script> tag should be treated as characters until a </script> tag is seen.
On Wed, Oct 24, 2012 at 2:42 AM, Dean Mao <deanmao@gmail.com> wrote:
I'm trying out the hubbub parser and I gave it a test run on the google homepage's html, but it thinks a piece of javascript as the beginning script tag. I used the tokeniser.c in the test directory to test it out.Here's the relevant output:CHARACTERS: '&'CHARACTERS: 'd!=this;d=d.parentNode){var E=d,u,e=E;u=a;var v=e.__jsaction;if(!v){var v=e.__jsaction={},l=f;"getAttribute"in e'CHARACTERS: '&'CHARACTERS: '&'CHARACTERS: '(l=e.getAttribute("jsaction"));if(e=l)for(var e=e.split(p),l=0,n=e?e.length:0;l'START TAG: 'n;l++){var' attributes:'j' = 'e[l];if(j){var''g' = 'j.indexOf(":"),m=-1!=g,w=m?j.substr(0,g).replace(/^\s+/,"").replace(/\s+$/,""):"click",j=m?j.substr(g+1).replace(/^\s+/,"").replace(/\s+$/,""):j;v[w]=j}}}if(u=v[u]){a={eventType:a,event:b,targetElement:t,action:u,actionElement:E};break''a}}a' = 'f}a&&(b.stopPropagation?b.stopPropagation():b.cancelBubble=!0,"A"==a.actionElement.tagName&&"click"==h&&(b.preventDefault?b.preventDefault():b.returnValue=!1),c.d?c.d(a):(t=a,b=(d=i.document)&&!d.createEvent&&d.createEventObject?d.createEventObject(b):b,t.event=b,c.c.push(a)))};var''g;g' = 'function(b){var''a' = 'h,c=n,d=!1;if(b.addEventListener){if("focus"==a||"blur"==a)d=!0;b.addEventListener(a,c,d)}else''if(b.attachevent){"focus"' = '=a?a="focusin":"blur"==a&&(a="focusout");var'Essentially there's some javascript in there that looks like this:for(var e=e.split(p),l=0,n=e?e.length:0;l<n;l++){var j=e[l];if(j){var g=j.indexOf(":"),m=-1!=g,w=m?j.substr(0,g).replace(/^\s+/,"").replace(/\s+$/,""):"click",j=m?j.substr(g+1).replace(/^\s+/,"").replace(/\s+$/,""):j;v[w]=j}}}if(u=v[u]){a={eventType:a,event:b,targetElement:t,action:u,actionElement:E};breakAnd it thinks that this is the beginning of an html tag: <n;l++) -- it's a comparison statement inside the for-loop.Any clues where I might start looking to see why this might be?
No comments:
Post a Comment