?
avatar mbabker
mbabker
14 Nov 2016

We do not offer APIs or any simple way to add attributes to some of the base HTML elements (<html> and <body> being the common ones you'd want to target), meaning you're left to a onAfterRender plugin event to manipulate the fully compiled HTML or JavaScript manipulating the DOM. We can do better.

avatar mbabker mbabker - open - 14 Nov 2016
avatar joomla-cms-bot joomla-cms-bot - change - 14 Nov 2016
Labels Added: ?
avatar dgt41
dgt41 - comment - 14 Nov 2016

Joomla doesn't control those elements in the core, everything is up to the template. So I see two possible solutions here:

  • either introduce <jdoc:include type="html" /> and <jdoc:include type="body" /> (I don't like doc)
  • or do some reg ex and replace the fethced template, which also is not a nice solution
avatar mbabker
mbabker - comment - 14 Nov 2016

The <jdoc> tags should be left to full sections of HTML, not for elements of a single tag. That's a no-go by me.

If the regex solution is what we're offering then this might as well be closed out, that's exactly what onAfterRender offers now.

It shouldn't be that hard to come up with hooks to add this data then echo it similar to WordPress' body_class() or language_attributes() functions. Ya it's reliant on the template implementing support for those features, but everything HTML related is reliant on the template honestly (imagine one that excludes the component <jdoc> tag then people wondering why they're missing stuff). You're right about Joomla not controlling these elements, but we can give APIs to folks and reasons for the template devs to adapt quickly.

avatar dgt41
dgt41 - comment - 14 Nov 2016

The tags should be left to full sections of HTML, not for elements of a single tag. That's a no-go by me.

If the regex solution is what we're offering then this might as well be closed out, that's exactly what onAfterRender offers now.

I do agree on both! I just responded with the easy quick/dirty fixes. Do you expect this to land in 3.x?

avatar mbabker
mbabker - comment - 14 Nov 2016

I doubt it will because I doubt many will have the patience to write up that part of the API and the ones that might are already overworked. But it should land somewhere, preferably this decade.

avatar dgt41
dgt41 - comment - 14 Nov 2016

Yeah, maybe together with the js abstraction layer... ?

avatar brianteeman brianteeman - change - 26 Nov 2016
Category Libraries
avatar franz-wohlkoenig franz-wohlkoenig - change - 5 Apr 2017
Status New Discussion
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - unlabeled - 25 Mar 2018
avatar mbabker
mbabker - comment - 3 Apr 2018

This'll never happen.

avatar mbabker mbabker - change - 3 Apr 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-04-03 12:05:47
Closed_By mbabker
Labels Removed: J3 Issue
avatar mbabker mbabker - close - 3 Apr 2018

Add a Comment

Login with GitHub to post a comment