Re: Improving the DOM

On Tue, 08 Nov 2011 15:41:09 -0700, Olli Pettay <Olli.Pettay@helsinki.fi>  
wrote:
> On 11/08/2011 11:30 PM, Anne van Kesteren wrote:
>> We introduce a DocumentContent union type (DOMString maps to a Text  
>> node):
>
> DOMString as Text node feels quite awkward. All the JS strings in a web
> page would have .previous/nextSibling properties?

The plan is to define that passing a DOMString to a method that takes  
DocumentContent results in a Text node being created with the contents of  
the DOMString.


>> We introduce these methods on Element, DocumentFragment, and  
>> CharacterData:
>>
>> before(DocumentContent... nodes)
>> after(DocumentContent... nodes)
>
> I don't quite understand what these would do. Something like  
> insertBefore?

Yes. The put nodes before and after the node they are invoked on.


>> We introduce this method on Element and CharacterData:
>>
>> replace(DocumentContent... nodes)
>
> What would CharacterData.replace(someelement) do?

If it's e.g. a Text node it would be replaced by an Element node.


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

Received on Tuesday, 8 November 2011 22:55:34 UTC