And I find that I can't use setAttributeNS for things like xml:lang:
> Error
> at /home/rubys/node.js/lib/node/.npm/jsdom/0.1.23/package/lib/jsdom/level2/core.js:19:11
> at Object.setAttributeNS (/home/rubys/node.js/lib/node/.npm/jsdom/0.1.23/package/lib/jsdom/level2/core.js:233:3)
> at EventEmitter.do_token (/home/rubys/git/xml5/lib.js/parser.js:77:18)
> at EventEmitter.<anonymous> (/home/rubys/git/xml5/lib.js/parser.js:136:30)
> at EventEmitter.emit (events:31:17)
> at EventEmitter.emitToken (/home/rubys/git/xml5/lib.js/tokenizer.js:85:7)
> at EventEmitter.emit_current_token (/home/rubys/git/xml5/lib.js/tokenizer.js:1536:7)
> at EventEmitter.empty_tag_state (/home/rubys/git/xml5/lib.js/tokenizer.js:1335:8)
> at EventEmitter.<anonymous> (/home/rubys/git/xml5/lib.js/tokenizer.js:72:24)
> at EventEmitter.emit (events:28:17)
Working around this, I find that I can call createAttributeNode but
there is no ability provided to call setAttributeNode.
At the moment, I've been monkey-patching:
https://github.com/rubys/xml5/blob/master/lib.js/testrunner.js
But I would like a more sustainable solution.
Is there some place to discuss these issues, or should I simply fork the project and submit
pull requests?
I'm quite willing, but my preference is for some discussion before I dive in as am I am not sure what the best way to,
for example, disable functionality like automatic uppercasing of node names would be.
> Error: Cannot find module 'mjsunit.runner/runner'
I'm new to node.js
How about reproduction instructions? :-)
git clone https://github.com/rubys/xml5.git
cd xml5/lib.js
nodeunit lib.js
> Working around this, I find that I can call createAttributeNode but
> there is no ability provided to call setAttributeNode.
>
> I assume you mean setAttributeNS
I was referring to:
https://developer.mozilla.org/en/DOM/element.setAttributeNode
In any case, if I create an attribute node that is not associated with
an element, what API should I use to add it to an attribute?
> At the moment, I've been monkey-patching:
>
> https://github.com/rubys/xml5/blob/master/lib.js/testrunner.js
>
> But I would like a more sustainable solution.
>
> Agreed, I'm slowly but surely implementing xmlns support in jsdom as of
> HEAD jsdom passes 64% of the DOM level 2 core tests (100 tests failing).
My immediate need is to address those four failing tests. If I can help
in any way, I will try.
> Is there some place to discuss these issues, or should I simply fork
> the project and submit
> pull requests?
>
> Feel free to post here, or raise issues on github. As for patches, I
> readily apply good patches (new code needs to be unit tested).
Will do.
> I'm quite willing, but my preference is for some discussion before I
> dive in as am I am not sure what the best way to,
> for example, disable functionality like automatic uppercasing of
> node names would be.
>
> There is a whole slew of tests in level1/core that ensure that this
> behavior is correct. I'm pretty sure the default is to maintain the
> casing of node names, but I may be mistaken.
> (https://github.com/tmpvar/jsdom/blob/master/lib/jsdom/level1/core.js#L313-323)
The default is maintained internally, but my problem is that when I try
to access it, it is upper cased on the way out. See:
http://intertwingly.net/blog/2011/01/13/xml5-js#c1294948131
> > Error: Cannot find module 'mjsunit.runner/runner'
>
> Ah, just run an `npm install mjsunit.runner` you may also want to
> install htmlparser (`npm install htmlparser`)
Thanks! (It wouldn't hurt to mention that in a README some place)
> I'm new to node.js
>
> Welcome!
Thanks again!
> -- Elijah
- Sam Ruby
How about reproduction instructions? :-)That is a strange error, do you think you could provide a bit more
information?
git clone https://github.com/rubys/xml5.git
cd xml5/lib.js
nodeunit lib.js
I was referring to:Working around this, I find that I can call createAttributeNode but
there is no ability provided to call setAttributeNode.
I assume you mean setAttributeNS
https://developer.mozilla.org/en/DOM/element.setAttributeNode
In any case, if I create an attribute node that is not associated with an element, what API should I use to add it to an attribute?
At the moment, I've been monkey-patching:
https://github.com/rubys/xml5/blob/master/lib.js/testrunner.js
But I would like a more sustainable solution.
Agreed, I'm slowly but surely implementing xmlns support in jsdom as of
HEAD jsdom passes 64% of the DOM level 2 core tests (100 tests failing).
No problem.
> That is a strange error, do you think you could provide a bit more
> information?
>
>
> How about reproduction instructions? :-)
>
> git clone https://github.com/rubys/xml5.git
> cd xml5/lib.js
> nodeunit lib.js
>
> hrm, looks like there is still 4 tests failing even though the HEAD of
> jsdom is only failing 3 tests against the main w3 suite. We should
> figure out what is going on here.
I'm running with
export NODE_PATH=/home/rubys/git/jsdom/lib
Additionally, there is a typo in the above that perhaps you caught, it
should be:
nodeunit testrunner.js
I reran the tests, and most of them failed; I took a look at it and one
of my workarounds had to be adjusted. With a simple fix:
https://github.com/rubys/xml5/commit/29e8ebf992e353e2ae43c365c5f94417ce0e0613
... now all of the tests pass again (albeit with workarounds).
> Working around this, I find that I can call
> createAttributeNode but
> there is no ability provided to call setAttributeNode.
>
> I assume you mean setAttributeNS
>
>
> I was referring to:
>
> https://developer.mozilla.org/en/DOM/element.setAttributeNode
>
> In any case, if I create an attribute node that is not associated
> with an element, what API should I use to add it to an attribute?
>
>
> yes.
>
> var attr = document.createAttributeNodeNS("namespace",
> "prefix:localName", "value");
> someOtherElement.setAttributeNodeNS(attr);
>
> At the moment, I've been monkey-patching:
>
> https://github.com/rubys/xml5/blob/master/lib.js/testrunner.js
>
> But I would like a more sustainable solution.
>
> Agreed, I'm slowly but surely implementing xmlns support in
> jsdom as of
> HEAD jsdom passes 64% of the DOM level 2 core tests (100 tests
> failing).
>
>
>
> jsdom is currently at 3 failing tests (level2/core), although I'm not
> completely satisfied with this status and will be fixing these very soon.
Once you are satisfied, perhaps we can work together to eliminate (or at
least reduce) the number of hacks and workarounds I need to apply.