Re: [whatwg] Should script run if it comes from a HTML fragment?
On Thu, 10 Feb 2011, Henri Sivonen wrote: > > > > * innerHTML doesn't run scripts and they are inserted disabled. > > FWIW, here's a counter-example: http://www.oele.net/innerhtmljs2.html > > The above runs the script in all browsers except Firefox 4 (which > follows the spec). The pattern is reportedly from the > http://crossbrowserajax.com/ library. > > However, http://www.oele.net/innerhtmljs.html doesn't run in IE9 PP7. > > I'm not thrilled about adding code to support this quirky pattern at > this point of the release cycle (evang is being attempted), but I > thought I'd mention this finding even though I'm not asking for a spec > change (at least not yet). Wow. That difference is absurd. Since Gecko and WebKit both do what the spec says now, I've left the spec as is. I don't even know where I'd begin in terms of doing what IE does here. -- Ian Hickson U+1047E)\._.,--,'``.fL http://ln.hixie.ch/ U+263A/, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Re: [whatwg] Should script run if it comes from a HTML fragment?
> * innerHTML doesn't run scripts and they are inserted disabled. FWIW, here's a counter-example: http://www.oele.net/innerhtmljs2.html The above runs the script in all browsers except Firefox 4 (which follows the spec). The pattern is reportedly from the http://crossbrowserajax.com/ library. However, http://www.oele.net/innerhtmljs.html doesn't run in IE9 PP7. I'm not thrilled about adding code to support this quirky pattern at this point of the release cycle (evang is being attempted), but I thought I'd mention this finding even though I'm not asking for a spec change (at least not yet). -- Henri Sivonen hsivo...@iki.fi http://hsivonen.iki.fi/
Re: [whatwg] Should script run if it comes from a HTML fragment?
On Thu, 11 Nov 2010, Ryosuke Niwa wrote: > > I'm working on the WebKit bug 12234 - Using createContextualFragment to > insert a
Re: [whatwg] Should script run if it comes from a HTML fragment?
On Sat, Nov 13, 2010 at 6:14 AM, Ms2ger wrote: > Ms2ger wrote: >> >> Ryosuke Niwa wrote: >>> >>> On Fri, Nov 12, 2010 at 2:29 PM, Jonas Sicking wrote: You looking at only part of what Henri said. He also pointed to http://www.w3.org/Bugs/Public/show_bug.cgi?id=11191 which is a request to change HTML5 so that createContextualFragment can specify that scripts should remain executable. >>> >>> However, this request has not been granted yet. >>> >> >> The specification [1] now states: >> >> > Mark all scripts in /new children/ as "already started". >> > > This should have said "Unmark". Unfortunately, this update hasn't propagated > to html5.org yet, but please take this (unmarked, to be executed) as the > current status. > > Apologies for any confusion caused. For what it's worth, IMHO "unmark X as 'foo'" is a pretty confusing construct. It'd might be a bit clearer to say: Unset the "already started" flag on all scripts in /new children/. and maybe even add an informative note as to what the effect of this is (that scripts can execute if later inserted into a document). / Jonas
Re: [whatwg] Should script run if it comes from a HTML fragment?
After reading all the responses and consulting with several developers at Google and other WebKit contributors, I have reached the conclusion that we should fix this bug, and the script parsed by createContextualFragment should, indeed, run when the fragment is inserted into a document. I'll follow up when the bug is fixed and WebKit's behavior is matched that of Firefox. Best regards, Ryosuke Niwa Software Engineer Google Inc. On Thu, Nov 11, 2010 at 4:34 PM, Ryosuke Niwa wrote: > Greetings all, > > I'm working on the WebKit bug 12234 - Using createContextualFragment to > insert a does not cause the script to > execute<https://bugs.webkit.org/show_bug.cgi?id=12234>. > While investigating the issue, the following part of HTML5 spec came to my > attention: > > *10.2.5.7 The "in head" insertion > mode<http://www.whatwg.org/specs/web-apps/current-work/#parsing-main-inhead> > * > ... > >- *A start tag whose tag name is "script"* >1. If the parser was originally created for the HTML fragment parsing > algorithm, then mark the script element as "already started". (fragment > case) > > Since 10.4 Parsing HTML > fragments<http://www.whatwg.org/specs/web-apps/current-work/#fragment-case>does > not special case the script element, this seem to imply that we never > execute scripts inserted by the HTML fragment parsing algorithm. Am I > right? > > To give you more concrete example, should the following markup show the > alert or not? > > > > >