[whatwg] Should script run if it comes from a HTML fragment?

On Fri, Nov 12, 2010 at 2:29 PM, Jonas Sicking <jonas at sicking.cc> 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.

 >> * Since scripts don't execute synchronously from within
> >> createContextualFragment the caller doesn't have to deal with weird
> >> reentrancy issues during parsing.
> >
> > Sure but that means we have to special-case fragments created
> > by createContexualFragment.  That adds extra complexity to the HTML
> fragment
> > parsing algorithm.
>
> I'd prefer to single out scripts only in one API than in multiple ones.
>

innerHTML and createContexualFragment both use the HTML fragment parsing
algorithm.  If you had implemented these features as described in the spec,
there should be no differences.

My concern is that treating script elements in a fragment differently based
on whether the fragment was added by innerHTML or createContextualFragment
is confusing to the developers.  I would, if I was a developer.  If
developers wanted to load a script file, they can explicitly load the file
and use eval, no?

>> For these reasons we decided to keep Firefox 4 behaving like previous
> >> versions of firefox and allow scripts created using
> >> createContextualFragment to execute.
> >
> > However, Firefox 4.0 Beta 6 does not execute the script as far as I
> tested.
> >  Try opening http://dscoder.com/MessageStyle/testcase.html
>
> That's old code at this point. And it resulted in people filing bugs
> on us. I forget if we fixed it for beta7 or not, but if you try recent
> nightlies it should work there.
>

OK.  Thanks for clarification.

- Ryosuke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20101112/bbdeb779/attachment-0001.htm>

Received on Friday, 12 November 2010 14:54:31 UTC