Re: Offline transcript

On Thursday, January 3, 2013 at 1:36 PM, François REMY wrote:

> I do like the idea of a “next” Prefix:  
>  
> var x = new nextXMLHttpRequest();
>  
> As long as people do use a prefix, whatever it is, I think we are fine. A polyfill should be able to work with any prefix, it’s up to the user to decide which prefix it want, not to the developer (because the prolyfill developer can’t think about all prefix conflicts an author may face, while the final website author can).
>  
>  
>  
> However, I continue to believe that the best option is namespacing/modules.  
>  
> var nxhr = { ... } // prolyfil module
> var x = new nxhr.XMLHttpRequest();
>  
> You can do the same with extensions to an interface (here: HTMLElement)
>  
> document.body.nxhr.loadContent("/articles/"+articleID+"/html");
>  
>  
> I believe we should develop both approaches in our WebIDL converter, and let people choose what they prefer when using the prolyfil, something like:
>  
> nxhr.importNoPrefix();
> // var x = new XMLHttpRequest(); document.body.loadContent(...)
>  
> nxhr.importPrefix("x")  
> // var x = new xXMLHttpRequest(); document.body.xLoadContent(...)
>  
> nxhr.importNamespace("nxhr")  
> // var x = new nxhr.XMLHttpRequest(); document.body.nxhr.loadContent(...)
>  
>  
> What do you think of this?
>  

I think namespacing is a good approach - but still risks clashing if not done well. The advantage of xWhatever, particularly on interfaces exposed on the global scope is that they are more or less guaranteed not to clash with host objects (as those all start with a capital letter).   

Received on Thursday, 3 January 2013 14:19:50 UTC