When using the AngularJS Module (angularjs), it adds "partials" (AngularJS templates) as script tags with the attribute type="text/ng-template" in the footer.

When using Bootstrap or a sub-theme, the type attribute is unset by bootstrap_process_html_tag() in theme/system/html-tag.vars.php on line 14.

I have tried to override this functionality by implementing the hook_process_html_tag() in my sub-theme template.php. However, since the type attribute is unset, I can not get the data back. I can add the property back by looking at the tag type and id (partials should have an id of 'partials/template.html').

My question is, is there a better way to fix this issue? And can we think of a way to optionally strip out unnecessary attributes? AFAIK, all of the opinionated Single Page Architecture libraries do something like this with tags (AngluarJS, EmberJS, etc) and thus keeping track of these special cases may wind up being impossible on your end.

Any discussion on best practices for this or guidance on a better solution is greatly appreciated!

Comments

markhalliwell’s picture

Title: Bootstrap Subtheme & AngularJS Module: script type stripped out » bootstrap_process_html_tag() is too aggressive
Version: 7.x-3.0 » 7.x-3.x-dev
Category: Feature request » Bug report
Priority: Normal » Major
Status: Active » Fixed

Committed f2fc05b to 7.x-3.x:

Issue #2201779 by Mark Carver | MD3: bootstrap_process_html_tag() is too aggressive.

markhalliwell’s picture

Version: 7.x-3.x-dev » 8.x-3.x-dev
Assigned: Unassigned » ryan.armstrong
Status: Fixed » Needs review

  • Commit f2fc05b on 7.x-3.x, 8.x-3.x by Mark Carver:
    Issue #2201779 by Mark Carver | MD3: bootstrap_process_html_tag() is too...

  • Mark Carver committed f2fc05b on 8.x-3.x.x
    Issue #2201779 by Mark Carver | MD3: bootstrap_process_html_tag() is too...
markhalliwell’s picture

Version: 8.x-3.x-dev » 7.x-3.x-dev
Assigned: ryan.armstrong » Unassigned
Status: Needs review » Closed (fixed)

I'm just moving this back to 7.x. If this needs re-evaluation in 8.x, create a new issue.

dejan0’s picture

If any other poor people using bootstrap 7.x-3.0, and having an issue with stripping `type="application/ld+json"` attribute from schema_metatag or any other module, here is @markcarver solution in patch form :)

dejan0’s picture

dejan0’s picture

If any other poor people using bootstrap 7.x-3.0, and having an issue with stripping `type="application/ld+json"` attribute from schema_metatag or any other module, here is @markcarver solution in patch form :)

markhalliwell’s picture

If you're using bootstrap 7.x-3.0, you really should upgrade to the latest version... that release is over 7 years old!