Hi all,
I'm working on a server-side DOM implementation for v8/nodejs, which
will use libxmljs as a foundation.
Marco has an example of how libxmljs could be augmented here:
http://gist.github.com/603881
This is pretty much the method I've been using.
I am running into a problem when libxmljs and the DOM have attributes
or methods with the same name:
- libxmljs has method: element.nextSibling()
- DOM has attribute: element.nextSibling
If I extend libxmljs.Element.prototype.nextSibling to achieve the DOM
attribute, I destroy the original libxmljs method. To fix this, I
have to make a renamed backup copy of the original, and thus break the
original libxmljs API. An example:
http://gist.github.com/610446
I guess I'd need a way to detect inside the function whether it was
invoked as a method or an attribute. But, I don't think you can have
both a value function, and a getter function - it's either/or.
Making these backup+renamed methods is ugly. It would still work if
my DOM library was separate from libxmljs. But if this was to be part
of libxmljs, this wouldn't cut it.
thanks for any ideas.
Brev