Re: Use cases for Range::createContextualFragment and script nodes

2010-10-22 Thread Anne van Kesteren
On Thu, 21 Oct 2010 08:43:18 +0200, Maciej Stachowiak m...@apple.com  
wrote:
It should probably be added to a spec at some point. Perhaps Web DOM  
Core could be expanded to cover Range  Tranversal?


There is:

  http://bitbucket.org/ms2ger/dom-range


I am not sure if it is a good idea to put Range into DOM Core. Range  
probably means doing Selection too and that is quite far away from what  
DOM Core is about.



--
Anne van Kesteren
http://annevankesteren.nl/



Re: Use cases for Range::createContextualFragment and script nodes

2010-10-21 Thread Maciej Stachowiak

On Oct 20, 2010, at 9:41 PM, Adam Barth wrote:

 On Wed, Oct 20, 2010 at 7:14 AM, Stewart Brodie
 stewart.bro...@antplc.com wrote:
 Henri Sivonen hsivo...@iki.fi wrote:
 When WebKit or Firefox trunk create an HTML script element node via
 Range::createContextualFragment, the script has its 'already started' flag
 set, so the script won't run when inserted into a document. In Opera 10.63
 and in Firefox 3.6.x, the script doesn't have the 'already started' flag
 set, so the script behaves like a script created with
 document.createElement(script) when inserted into a document.
 
 I'd be interested in use cases around createContextualFragment in order to
 get a better idea of which behavior should be the correct behavior going
 forward.
 
 Does the specification for createContextualFragment say anything about this?
 
 I don't believe such a spec exists, or at least I couldn't find one
 the other month.

It is indeed not part of any standard. It was originally a Mozilla vendor 
extension, later copied by Opera and Safari. We added support for it in 2002 
because at least at the time, some sites used it: 
http://trac.webkit.org/changeset/2940

It should probably be added to a spec at some point. Perhaps Web DOM Core could 
be expanded to cover Range  Tranversal?

Regards,
Maciej




Re: Use cases for Range::createContextualFragment and script nodes

2010-10-21 Thread Olli Pettay

On 10/21/2010 09:43 AM, Maciej Stachowiak wrote:


On Oct 20, 2010, at 9:41 PM, Adam Barth wrote:


On Wed, Oct 20, 2010 at 7:14 AM, Stewart Brodie
stewart.bro...@antplc.com  wrote:

Henri Sivonenhsivo...@iki.fi  wrote:

When WebKit or Firefox trunk create an HTML script element node
via Range::createContextualFragment, the script has its
'already started' flag set, so the script won't run when
inserted into a document. In Opera 10.63 and in Firefox 3.6.x,
the script doesn't have the 'already started' flag set, so the
script behaves like a script created with
document.createElement(script) when inserted into a
document.

I'd be interested in use cases around createContextualFragment
in order to get a better idea of which behavior should be the
correct behavior going forward.


Does the specification for createContextualFragment say anything
about this?


I don't believe such a spec exists, or at least I couldn't find
one the other month.


It is indeed not part of any standard. It was originally a Mozilla
vendor extension, later copied by Opera and Safari. We added support
for it in 2002 because at least at the time, some sites used it:
http://trac.webkit.org/changeset/2940

It should probably be added to a spec at some point. Perhaps Web DOM
Core could be expanded to cover Range  Tranversal?


I'd actually like to get rid of it.
So perhaps browsers could start warn about using it.
(That ofc doesn't solve the problem Henri has atm.)

-Olli



Re: Use cases for Range::createContextualFragment and script nodes

2010-10-21 Thread Maciej Stachowiak

On Oct 21, 2010, at 1:06 AM, Olli Pettay wrote:

 On 10/21/2010 09:43 AM, Maciej Stachowiak wrote:
 
 It is indeed not part of any standard. It was originally a Mozilla
 vendor extension, later copied by Opera and Safari. We added support
 for it in 2002 because at least at the time, some sites used it:
 http://trac.webkit.org/changeset/2940
 
 It should probably be added to a spec at some point. Perhaps Web DOM
 Core could be expanded to cover Range  Tranversal?
 
 I'd actually like to get rid of it.
 So perhaps browsers could start warn about using it.
 (That ofc doesn't solve the problem Henri has atm.)

Even 8 years ago it was pretty frequently used by Web sites, and I would not 
expect things to be different now. Also, it is apparently used in a number of 
JavaScript libraries: 
http://www.google.com/codesearch?as_q=createContextualFragment

I suspect getting rid of createContextualFragment is not a practical option at 
this point. And I expect a new entrant to the browser market would likely have 
to implement it to achieve sufficient Web compatibility. So I think it should 
be spec'd.

Out of curiosity, though, what's the reason to get rid of it?

Regards,
Maciej




Use cases for Range::createContextualFragment and script nodes

2010-10-20 Thread Henri Sivonen
When WebKit or Firefox trunk create an HTML script element node via 
Range::createContextualFragment, the script has its 'already started' flag set, 
so the script won't run when inserted into a document. In Opera 10.63 and in 
Firefox 3.6.x, the script doesn't have the 'already started' flag set, so the 
script behaves like a script created with document.createElement(script) when 
inserted into a document.

I'd be interested in use cases around createContextualFragment in order to get 
a better idea of which behavior should be the correct behavior going forward.

-- 
Henri Sivonen
hsivo...@iki.fi
http://hsivonen.iki.fi/



Re: Use cases for Range::createContextualFragment and script nodes

2010-10-20 Thread Stewart Brodie
Henri Sivonen hsivo...@iki.fi wrote:

 When WebKit or Firefox trunk create an HTML script element node via
 Range::createContextualFragment, the script has its 'already started' flag
 set, so the script won't run when inserted into a document. In Opera 10.63
 and in Firefox 3.6.x, the script doesn't have the 'already started' flag
 set, so the script behaves like a script created with
 document.createElement(script) when inserted into a document.
 
 I'd be interested in use cases around createContextualFragment in order to
 get a better idea of which behavior should be the correct behavior going
 forward.

Does the specification for createContextualFragment say anything about this?


-- 
Stewart Brodie
Team Leader - ANT Galio Browser
ANT Software Limited



Re: Use cases for Range::createContextualFragment and script nodes

2010-10-20 Thread Adam Barth
On Wed, Oct 20, 2010 at 7:14 AM, Stewart Brodie
stewart.bro...@antplc.com wrote:
 Henri Sivonen hsivo...@iki.fi wrote:
 When WebKit or Firefox trunk create an HTML script element node via
 Range::createContextualFragment, the script has its 'already started' flag
 set, so the script won't run when inserted into a document. In Opera 10.63
 and in Firefox 3.6.x, the script doesn't have the 'already started' flag
 set, so the script behaves like a script created with
 document.createElement(script) when inserted into a document.

 I'd be interested in use cases around createContextualFragment in order to
 get a better idea of which behavior should be the correct behavior going
 forward.

 Does the specification for createContextualFragment say anything about this?

I don't believe such a spec exists, or at least I couldn't find one
the other month.

Adam