Thread Starter
AlphaK
(@alphak)
Well, some more info.
Validation is correct with doctypes XHTML 1.0 Transitional but not with doctypes XHTML 1.1. So basically validation will have a different result depending on the theme used.
I don’t know if WordPress recommends to use a particular doctype in themes. The validation problem occurs with the iNove one.
Maybe it could be possible to have that tag validated against both doctypes…
Grr. I guess I’ll need to use some other type of anchor.
What do you think is the best element to use inside of <head> that accepts an ID?
Thread Starter
AlphaK
(@alphak)
I searched the whole XHTML 1.1 DTD and unfortunately, from my understanding there is no child tag of the <head> element that accepts the attribute “id” 🙁
What about class then?
Basically I need an anchor element to use that is after style.css that my Javascript can look for an inject stylesheets after.
Thread Starter
AlphaK
(@alphak)
OK. If my understanding is correct, you use it in the following code :
document.getElementsByTagName("head")[0].insertBefore( corecss, document.getElementById("syntaxhighlighteranchor") );
Then why not adding your stylesheets at the end of the head element ? Then there is no need for an id nor a class. This code might do the trick :
document.getElementsByTagName("head")[0].appendChild(corecss);
That’s the exact code I had been using. The problem with that is that it then becomes impossible for people to override the plugin’s CSS unless they create a custom plugin theme or edit the plugin’s files.
The advantage of the current set up is someone can hook into wp_head at priority 20 or whatever and then output a stylesheet with some !important rules.
Thread Starter
AlphaK
(@alphak)
Huge history as I can see.
Again in XHTML 1.1 none of the mandatory child element of the <head> tag support a class attribute.
Then I may suggest 2 workarounds :
First one : to cycle manually through meta tags until the one which attribute name equals syntaxhighlighter-version is found. There we can insert corecss and themecss just before.
Second one : to do the same but using WordPress’s internal jQuery to catch the correct tag using a direct selector, that would look like : $('meta[@name="syntaxhighlighter-version"]')
Both solutions may imply a loss of performance during the script load, but negligible I assume.
I don’t want to load up jQuery just to do that, as much as I love jQuery. 🙂
I like the first solution. My crappy Javascripts skills and I will give that a go. Thanks.