I’m trying to get the GPLv3 comment interface working on Konqueror, and I’ve made some interesting discoveries about what Konqueror’s KHTML doesn’t support,Â though Safari’s supports some of them. Among these:
getElementById(): XHTML elements whose tags are not part of HTML cannot be gotten by getElementById(). I.e., I have <section id=”foo.p1.s3″> and <sent id=”bar.p3.s1″>, and FireFox will getElementById these for me without complaint or warning, and the w3 validator doesn’t have a problem with these elements having these attributes. Konqueror (and I think Safari, too, so, KHTML), on the other hand, won’t get them unless I rename all of them to <span id=”foo.p1.s3″> instead. My file doesn’t quite validate as XHTML1.1 transitional, though, so there’s a chance it’s better for perfectly-valid XHTML. But I doubt it.
document.getSelection(): Firefox and the DOM recommendation give you a selection object with all sorts of useful attributes: anchorNode (the node where the selection begins), focusNode (where the selection ends), other goodies. Konqueror gives you the selected text and nothing else.
So it’s time for me to write an alternate submission mechanism for stet, a Mason script that takes one argument: the selection. Then it looks in the master text for your selection, and if it finds it, it asks you to type the rest of your comment, otherwise gives an error. This could still be pretty ajaxy, though at some point someone is also going to need a plain old simple HTML form, and I might as well implement these two at the same time.
serializing xml: ha ha you sucker, just use the DOM laboriously for even the simplest task. Actually what I need to do is write my own serializer, which will just go through all the children and copy all their children and attributes recursively. So straightforward, it boggles that KHTML haven’t already implemented it/ported it from Safari.