Problem/Motivation

#1993334: Add HTML5shiv to Stable and Classy only tried to remove html5shiv from core. The motivation behind it was that core does not support IE8 any longer. If you're building a modern front-end, you'll drop support for IE8 - and maybe even IE9. This means there no need to include html5shiv. When creating a new Drupal 8 theme, html5shiv is always loaded; and it not documented on how to get rid of html5shiv in your theme.

Proposed resolution

- Get #1993334: Add HTML5shiv to Stable and Classy only in and just remove shiv … but that seems unlikely.
- Write documentation on how you can remove this library.

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sqndr’s picture

Category: Bug report » Task
attiks’s picture

Wim Leers’s picture

Roughly: hook_element_info_alter(), do unset($types['html']['#attached']).

sqndr’s picture

Does hook_element_info_alter() work? I'm working on Panda theme. I've implemented the hook inside panda.theme, without any result. If I add exit; to file and reload, the page is blank, so I'm sure Drupal reads the file. Then I went to core's seven.theme, because it's implementing the hook as well. I tried several ways of adding and removing things in this hook (Seven implements), but it seems to me it's not doing much?

Wim Leers’s picture

Assigned: Unassigned » catch

It doesn't work in your Panda theme, because:

    // Allow modules to alter the element type defaults.
    $this->moduleHandler->alter('element_info', $info);

… it's only invoked for modules. I think that's a bug; themes should be able to alter existing elements, even if only to attach their own assets to it. (Or, in this case, to remove it.)

Pinging catch about that.

sqndr’s picture

That's what I thought … but yeah, it should be reported as a bug because Seven implements the hook as well ;) Let me know the result!

Wim Leers’s picture

Asked catch, his response:

16:13:28 catch: WimLeers: are elements cached by theme?
16:15:19 WimLeers: catch: oh………
16:15:26 WimLeers: catch: that is a very very very very good point
16:15:31 WimLeers: catch++
16:15:42 WimLeers: catch: they should be, indeed for that reason
16:16:12 catch: WimLeers: there's an issue somewhere about themes and hook_theme_registry_alter()

So we can fix #6, but we'll have to make sure elements are cached by theme. All render caching already happens per theme (for analogous reasons), so there's no problem there.

Wim Leers’s picture

Assigned: catch » Unassigned
sqndr’s picture

sqndr’s picture

Since #2448843: [regression] Themes unable to implement hook_element_info_alter() got fixed, need to test this again, because this should now be possible.

sqndr’s picture

Assigned: Unassigned » sqndr
joelpittet’s picture

Version: 8.0.x-dev » 8.1.x-dev
Status: Active » Postponed

Postponing this as well

joelpittet’s picture

Status: Postponed » Active

We may be able to start working on this for 8.1

joelpittet’s picture

Title: Remove html5shiv from clean theme. » Remove html5shiv from being loaded.
Status: Active » Needs review

Here's a patch to remove it from being loaded but leaves it in core.

joelpittet’s picture

Title: Remove html5shiv from being loaded. » Remove html5shiv from being loaded
Assigned: sqndr » Unassigned
FileSize
5.06 KB

With patch

Status: Needs review » Needs work

The last submitted patch, 16: remove_html5shiv_from-2409083-16.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
FileSize
5.06 KB
662 bytes

Whoops forgot my regex delims

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

joelpittet’s picture

Status: Needs review » Closed (duplicate)

Whoops this is a duplicate now of #1993334: Add HTML5shiv to Stable and Classy only