- From: Ryosuke Niwa <rniwa@apple.com>
- Date: Tue, 13 Jan 2015 10:18:11 -0800
- To: Domenic Denicola <d@domenic.me>
- Cc: Boris Zbarsky <bzbarsky@mit.edu>, Anne van Kesteren <annevk@annevk.nl>, WebApps WG <public-webapps@w3.org>, "www-dom@w3.org" <www-dom@w3.org>
> On Jan 13, 2015, at 9:25 AM, Domenic Denicola <d@domenic.me> wrote:
>
> From: Boris Zbarsky [mailto:bzbarsky@mit.edu]
>
>> But it also means that user-space code that has to create an HTML element generically now has to go through document.createElement instead of being able to do |new HTMLElement("a")|, right?
>
> That seems totally fine to me though. The idea of a string-based factory for when you don't know what constructor you want to use has precedent all over software design.
I agree. It's unusual for a constructor of a super class to automatically instantiate an arbitrary subclass based on its arguments. And we usually solve that convenience problem by introducing a factory class/function.
- R. Niwa
Received on Tuesday, 13 January 2015 18:19:06 UTC