Page 1 of 1
Invalid code in two plugins
Posted: Fri Oct 01, 2010 12:49 am
by yellowled
I stumbled across invalid (X)HTML emitted by two plugins today:
First of all, serendipity_plugin_twitter emits an img element which is not self-closing (<img ... />), which is invalid in XHTML doctypes.
The second one is debatable: The JS version of the twitter sidebar plugin emits a <ul> without any <li>, which also is invalid. Since the <ul> is filled with <li> elements using JS later, this is kind of a "technically invalid, practically not". Still, a rather simple solution would be to emit a single <li>, maybe linking to the configured twitter account's page, which would be removed from the DOM before inserting the dynamic elements.
However, I'm not exactly comfortable editing those myself, I just thought I'd mention it.
YL
Re: Invalid code in two plugins
Posted: Fri Oct 01, 2010 11:54 am
by garvinhicking
Hi!
First of all, serendipity_plugin_twitter emits an img element which is not self-closing (<img ... />), which is invalid in XHTML doctypes.
Where?
About the ul-injection, that's a good idea.
Regards,
Garvin
Re: Invalid code in two plugins
Posted: Fri Oct 01, 2010 1:46 pm
by yellowled
garvinhicking wrote:First of all, serendipity_plugin_twitter emits an img element which is not self-closing (<img ... />), which is invalid in XHTML doctypes.
Where?
In the sidebar, at least that's what I tested so far. As far as I can tell, any img element in the plugin is HTML 4.01 style, i.e. not self-closing.
YL
Re: Invalid code in two plugins
Posted: Sat Oct 02, 2010 11:35 pm
by garvinhicking
Hi!
Do you have an example? Does the img maybe come from twitter itself?!
Regards,
Garvin
Re: Invalid code in two plugins
Posted: Sun Oct 03, 2010 12:43 am
by yellowled
garvinhicking wrote:Do you have an example? Does the img maybe come from twitter itself?!
<mode="janice">Oh. My. God.</mode>
I'm sorry, I meant serendipity_plugin_
flickr, not twitter with the img thing. Jeez, I was already wondering why you asked about that ... sorry
YL
Re: Invalid code in two plugins
Posted: Sun Oct 03, 2010 12:52 am
by garvinhicking
Hi!
Ok, the img thing is fixed. About the ul injection, I put it on my list
Regards,
Garvin
Re: Invalid code in two plugins
Posted: Mon Oct 04, 2010 10:46 am
by garvinhicking
Hi!
I updated the twitter plugin to put an empty <li> in there.
Regards,
Garvin
Re: Invalid code in two plugins
Posted: Mon Oct 04, 2010 1:04 pm
by yellowled
garvinhicking wrote:I updated the twitter plugin to put an empty <li> in there.
Not sure an empty li is valid, either. It should contain some kind of information. Maybe we could put some text there? 'Requires Javascript' comes to mind.
YL
Re: Invalid code in two plugins
Posted: Fri Oct 15, 2010 4:16 pm
by yellowled
garvinhicking wrote:I updated the twitter plugin to put an empty <li> in there.
Here's another idea: The JS "version" of the plugin currently includes 2 JS files right where the plugin code itself is emitted in the sidebar. (I hope you get what I mean by that?)
Not sure whether it's possible, but it would be better in terms of performance to include those files at the bottom of the page, right before the closing </body> tag.
YL
Re: Invalid code in two plugins
Posted: Sat Oct 16, 2010 1:39 pm
by garvinhicking
HI!
That would only be possible when putting it in the event plugin instead of a sidebar plugin, which would IMHO too much confuse things...
Regards,
Garvin
Re: Invalid code in two plugins
Posted: Sat Oct 16, 2010 3:32 pm
by yellowled
garvinhicking wrote:That would only be possible when putting it in the event plugin instead of a sidebar plugin, which would IMHO too much confuse things...
I was aware that this might be your answer. Hm.
Of course, this isn't much of an issue concerning the twitter plugin - if somebody would really be aware of performance issue, they could simply switch to the PHP version of the plugin.
Then again, this might be a good point to tackle possible performance issues. onli has been doing a lot of great stuff with plugins using jQuery, but at least some of those insert <script> elements in the <head>, which isn't ideal, either. There are cases in which <script>
has to be in the <head>, but if possible, they
should be included right before the </body> tag.
I suppose in the future more and more plugins will require or use javascript. I also use jQuery in templates quite frequently. Maybe we should have some kind of (not really sure of the correct term here, but I'm sure you know what I mean) hook to insert all <script> elements which don't have to be in the head right before </body>.
I realize this might result in some substantial rewriting of plugins already inserting <script> elements as they please, but I'm sure Grandma would really appreciate this.
YL
Re: Invalid code in two plugins
Posted: Sun Oct 17, 2010 5:59 pm
by onli
>but at least some of those insert <script> elements in the <head>, which isn't ideal, either.
Indeed. I used the footer sometimes, but this isn't a really good solution because some templates simply don't print a footer, the footer-event never gets executed.
I don't know if it's really a good idea to mess with that now, async (or better: defer) with html5 should solve the problem with script-tags in the head.