Community Forums › Forums › Archived Forums › Design Tips and Tricks › Making Genesis W3C Valid? Remove unnecessary TYPE attribute from menu JavaScript
Tagged: child themes, html, js, validation
- This topic has 5 replies, 2 voices, and was last updated 6 years, 2 months ago by
Victor Font.
-
AuthorPosts
-
November 15, 2018 at 5:51 pm #224380
cbryant
MemberWhen trying to validate a Genesis Child Theme (the Genesis Sample child), the W3C Validator gives this error:
The type attribute is unnecessary for JavaScript resources.
There's plenty of help/snippets out there for removing the TYPE attribute from enqueued files. But they don't work on the Genesis Responsive Menu js that gets inserted in the footer.
Does anyone have any idea how to remove the unnecessary TYPE attribute from this JavaScript resource?
Thanks.
November 15, 2018 at 7:21 pm #224384Victor Font
ModeratorWhile the script is being loaded by the Genesis Sample theme in functions.php, Genesis is simply executing the WordPress wp_enqueue_script to do so. The type attribute is inserted by WordPress, not Genesis. You're best bet for finding a solutions is to Google and look at the many recommendations out there.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?November 15, 2018 at 7:51 pm #224385Victor Font
ModeratorI did my own Google search and found some code that works:
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?November 20, 2018 at 3:18 am #224467cbryant
MemberHi Victor,
Thank you for responding.
I apologize for not replying back sooner.
I think the forum notification went to spam.Either way - I'll check out the code you found and reply again.
Thanks!
November 22, 2018 at 3:11 am #224517cbryant
MemberHi Victor,
I checked out the code you'd found online.
I actually already have that code in my theme - and it works great for enqueued js and css.However, that code does not remove the TYPE attribute from the Genesis Responsive Menu setup script. That script is used/called (my js ignorance is showing) using wp_localize_script (not enqueue). So my hunch is that has something to do with it.
I need to move on to other issues for now.
But I'm determined to validate this Genesis theme.
So if I get a solution - I'll share here.
And hopefully, if someone else does, they will too.All the best,
November 24, 2018 at 11:46 am #224571Victor Font
ModeratorThe code I provided for you works for me with the responsive script. I tested it with multiple themes in my local environment and edited it for performance. Code used with wp_localize_script still requires a script to be enqueued. All wp_localize_script does is setup a script for translation. It has nothing to do with enqueuing.
Also if you look at the sample theme's functions.php. You'll see the responsive script is being enqueued right before wp_localize_script is called.
https://codex.wordpress.org/Function_Reference/wp_localize_script
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet? -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.