Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faces 4.0: OutputScript/OutputStyleSheet Remove 'type' attribute if HTML5 #1565

Closed
melloware opened this issue Apr 1, 2021 · 12 comments
Closed
Milestone

Comments

@melloware
Copy link

For Faces 4.0 I would like to remove the type="text/javascript" from h:outputScript as its completely unnecessary in the DOM and there is only 1 kind of script

W3C Validator warnings:
image

I think we should also remove it from OmniFaces 4.0 and PrimeFaces 11.0 in the spots it used.

I can submit PR's for Mojarra and MyFaces if acceptable?

cc @OBreidenbach who reported this originally here: primefaces/primefaces#4135

@christophs78
Copy link

Good point!

@BalusC
Copy link
Member

BalusC commented Apr 1, 2021

These are indeed optional in HTML5 but not in HTML4 (although the average webbrowser is lenient in this).

Also note that the same "issue" applies to <link|style type="text/css">. This is also optional in HTML5. So the same adjustments must be done for OutputStylesheet.

@melloware
Copy link
Author

Yep but with the Death of IE. Should Faces 4.0 just be an HTML5+ supporting framework?

@melloware melloware changed the title OutputScript: Remove 'type' attribute OutputScript/OutputStyleSheet: Remove 'type' attribute Apr 1, 2021
@BalusC
Copy link
Member

BalusC commented Apr 3, 2021

There should be a way for the HTML renderers to detect the doctype currently used. Facelets is capable of this but this is nowhere specified in Faces (as far as I see/know).

Blindly removing it would break validity of (existing) HTML4 pages.

@melloware
Copy link
Author

Ok detecting HTML5 doctype would be ideal. It would also be a nice addition to Faces

@BalusC
Copy link
Member

BalusC commented Apr 3, 2021

Doctype processing is already specced in section 1.1.1.1 of appendix A of the spec, but it's only specced as part of Facelets config.

I'm currently having difficulty where to add it to the Faces API. Neither UIViewRoot#isHtml5Doctype() nor RenderKit#isHtml5Doctype() make sense.

@BalusC
Copy link
Member

BalusC commented Apr 3, 2021

I've for the time being made it an implementation detail. If someone knows a valid and sensible API method for this then I'm all ears to add.

@melloware
Copy link
Author

@tandraschko any thoughts on this one?

@BalusC
Copy link
Member

BalusC commented Apr 4, 2021

After meditating a night on this one I think the closest candidate is UIViewRoot#getDoctype() and then leave it to the clients to sniff whether that's HTML5 or not. But then I'm in dubio whether it should return String or jakarta.faces.component.html.HtmlDoctype. If the latter, then we should ultimately need a new interface something like jakarta.faces.component.Doctype so that it can be declared as return type. This gives a proper degree of abstraction. A HTML5 doctype could then be identified by Doctype#getRootElement() returning html and the Doctype#getSystem() and Doctype#getPublic() both returning null.

@tandraschko
Copy link

UIViewRoot#getDoctype() sounds good

@melloware
Copy link
Author

I like your plan @BalusC

@melloware
Copy link
Author

MyFaces PR: apache/myfaces#198

Closing this ticket as its now implemented in MyFaces and Mojarra 4.0

@melloware melloware changed the title OutputScript/OutputStyleSheet: Remove 'type' attribute Faces 4.0: OutputScript/OutputStyleSheet Remove 'type' attribute if HTML5 Apr 6, 2021
@arjantijms arjantijms added this to the 4.0 milestone Nov 29, 2021
@arjantijms arjantijms added the 4.0 label Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants