DOM elements can only be created using `document.createElement`.
Nowadays there seem to be ways to create a custom prototype for it but it won't be very Haxe-friendly:
http://www.html5rocks.com/en/tutorials/webcomponents/customelements/
Philippe
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.
This can be done with abstracts. This is not really extending but is quite nice.
http://try.haxe.org/#d164A
You received this message because you are subscribed to a topic in the Google Groups "Haxe" group.
You received this message because you are subscribed to the Google Groups "Haxe" group.
Just make a regular class which takes an html element in the constructor (or creates) and make all access fields 'inline' - same effect.
Well, back in the day they called it 'composition' and some even claimed it's better than inheritance. ;-)
Just make a regular class which takes an html element in the constructor (or creates) and make all access fields 'inline' - same effect.
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.
I think the most straightforward approach is to make a wrapper class but this forces you to define every field (repeatedly) that you want to allow an user to use.
There's also another problem, that is will your class really extend an html element in a browser, ie. will you be able to add your custom class object into a DOM? If it doesn't, than all you can get is a syntax sugar by the use of abstract/wrapper classes (or 'using', indeed). Otherwise, there're aformentioned custom elements with all the cross-compatibility hell. :)
BTW. I have an idea, that I hasn't been able to test yet, of making a map of DOM objects to wrapping them custom class objects, which should make it possible to pass your custom object into a DOM functions with help of an 'abstract' class. Going from DOM into your code would require a look-up into the mappings and return wrapping object (with native DOM element in it).
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.
abstract classes can't have member variables...
calling test with: Array [ "hello", 2, "ça va ?" ]
myValue: toto
calling special element function: hello,2,ça va ?
Cheers !
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.