|
|
|
 |

November 14th, 2007, 01:42 PM
|
Private
|
|
Join Date: Nov 2007
Posts: 35
Thanks: 7
Thanked 20 Times in 5 Posts
|
|
Re: Spell Guide Beta-0
Hihi, that's a fair point!
My priority right now is learning and exploring some interesting web technologies. Using a pre-packaged framework is not very interesting for me since I wanted to start with the basics. Using server side XSLT is indeed something I have considered as a fallback, and I'll probably end up there if I find time/interest to finalize this thing.
Quote:
"Exception while loading: SpellDiv has no properties."
|
Yeah that's from firefox right? It's weird. Using the firefox dom inspector, I can clearly see the spell div, spell table and all the spells nicely tucked in there with the images and everything. But visually it still looks like it's just dumped the whole xml document in there without any xslt transformation. And getElementById('spelldiv') returns null ...
|

November 14th, 2007, 02:28 PM
|
 |
General
|
|
Join Date: Feb 2007
Location: R'lyeh
Posts: 3,861
Thanks: 144
Thanked 403 Times in 176 Posts
|
|
Re: Spell Guide Beta-0
Quote:
Snoddasmannen said:
Yeah that's from firefox right? It's weird. Using the firefox dom inspector, I can clearly see the spell div, spell table and all the spells nicely tucked in there with the images and everything. But visually it still looks like it's just dumped the whole xml document in there without any xslt transformation.
|
I guess that's because you are overwriting the element in Code:
parent.replaceChild(result.firstChild,spellDiv);
instead of overwriting the innerHTML element or something like that. Usually Mozilla is the closest to implement the specifications, so I guess that you're doing it wrong.
Here's what the element looks like before the replace:

and here's what it looks like afterwards:

|

November 14th, 2007, 06:45 PM
|
Private
|
|
Join Date: Nov 2007
Posts: 35
Thanks: 7
Thanked 20 Times in 5 Posts
|
|
Re: Spell Guide Beta-0
Hihi, actually you can make it look fine in firefox by opening firebug and having a look at the BODY tag's innerhtml attribute. Just doubleclick on it and leave the field without changing anything. I assume this forces an update of some internal structure and voila the table appears nicely. So obviously some FF quirk involved here.
There's probably an easy workaround to force it to do that without using firebug.
Apparently no support in FF2 yet for the nth-child-of css pseudoclass, so all the lines are white
By the way, it's quite likely that I'm doing some kind of corner case here which is poorly defined in the specs. Or at least working in a way which is not well explored or commonly used. Obviously firefox has excellent support for this kind of stuff in general.
EDIT: Added this line:
Code:
document.firstChild.innerHTML += "";
So now it actually works in firefox as well 
|

November 14th, 2007, 07:30 PM
|
 |
General
|
|
Join Date: Feb 2007
Location: R'lyeh
Posts: 3,861
Thanks: 144
Thanked 403 Times in 176 Posts
|
|
Re: Spell Guide Beta-0
This workaround resets the whole formular, though, all the values are reset to zero. Don't use workarounds as solution.
If you want to have it working in Mozilla, then you should have read how Mozilla handles these things first.  Your first problem is already mentioned in there:
Quote:
Mozilla requires that you send the XML and XSLT files with an XML mimetype (text/xml or application/xml). This is the most common reason why XSLT won't run in Mozilla but will in Internet Explorer. Mozilla is strict in that way.
|
The second problem is that you're replacing a DOM node by something of a different type. If I am reading the last paragraph in that article right then you can probably use transformToFragment() to have it working correctly. You are trying to put a DOM document into another one, not good.
|

November 15th, 2007, 03:17 AM
|
Private
|
|
Join Date: Nov 2007
Posts: 35
Thanks: 7
Thanked 20 Times in 5 Posts
|
|
Re: Spell Guide Beta-0
Quote:
lch said:
The second problem is that you're replacing a DOM node by something of a different type. If I am reading the last paragraph in that article right then you can probably use transformToFragment() to have it working correctly. You are trying to put a DOM document into another one, not good.
|
Actually I'm putting the firstChild of a dom document, ie the spelldiv, into another document. The resulting dom tree is obviously correct, but Mozilla isn't updating it correctly for some reason.
Doesn't make any sense to me why I would need to specify the destination document of a node at the time of creation, but on the other hand XSLTProcessor is a mozilla invention so they can do whatever they want with it.
But enough whining, I switched to transformToFragment() and yay it seems to work even without the ugly workaround!  Thanks lhc!
jimkehn, which browser are you using?
|

November 15th, 2007, 05:10 AM
|
 |
General
|
|
Join Date: Feb 2007
Location: R'lyeh
Posts: 3,861
Thanks: 144
Thanked 403 Times in 176 Posts
|
|
Re: Spell Guide Beta-0
Quote:
Snoddasmannen said:
Actually I'm putting the firstChild of a dom document, ie the spelldiv, into another document. The resulting dom tree is obviously correct, but Mozilla isn't updating it correctly for some reason.
Doesn't make any sense to me why I would need to specify the destination document of a node at the time of creation, but on the other hand XSLTProcessor is a mozilla invention so they can do whatever they want with it.
|
That has nothing to do with the XSLTProcessor or Mozilla, but that is coming directly from the standard for DOM. You *always* have to import your nodes into the document first with DOM if you want to use them. Even though Mozilla isn't doing what you want, they're doing it very correctly here.
|

November 15th, 2007, 11:55 AM
|
 |
Second Lieutenant
|
|
Join Date: Mar 2007
Posts: 559
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Re: Spell Guide Beta-0
i.e. 7 or whatever the newest version is. running xp.
|

November 15th, 2007, 01:31 PM
|
Private
|
|
Join Date: Nov 2007
Posts: 35
Thanks: 7
Thanked 20 Times in 5 Posts
|
|
Re: Spell Guide Beta-0
Quote:
lch said:
That has nothing to do with the XSLTProcessor or Mozilla, but that is coming directly from the standard for DOM. You *always* have to import your nodes into the document first with DOM if you want to use them.
|
Good to know! I guess Opera automagically imported it in the replaceChild function.
Quote:
Even though Mozilla isn't doing what you want, they're doing it very correctly here.
|
I'm not necessarily as enthusiastic about the way ff did this at you are, but let's leave it at that  When I do things right, they seem to work in both Opera and Firefox.
Not so much for IE though I'm afraid jimkehn  As I mentioned before, I may rewrite the page to add support for all kinds of clients, but right now I'll continue on this track and try to keep supporting Firefox as well as Opera.
Next up I'll try to add some handling of the national spells, they are just mixed in with all the others right now which is quite annoying.
Quote:
Can you post that as a stand alone executable that we could download to our hard drive??? This looks like a really neat tool that we could use.
|
That would indeed be a neat tool to have as a standalone, but quite a different beast from a web interface. Not on my roadmap I'm afraid.
|

November 14th, 2007, 09:24 PM
|
 |
Second Lieutenant
|
|
Join Date: Mar 2007
Posts: 559
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Re: Spell Guide Beta-0
snoddasmannen, I get:
Exception while loading: [object error]
|

November 15th, 2007, 11:58 AM
|
 |
Second Lieutenant
|
|
Join Date: Mar 2007
Posts: 559
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Re: Spell Guide Beta-0
Can you post that as a stand alone executable that we could download to our hard drive??? This looks like a really neat tool that we could use.
|
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
|
|