Skip to content
This repository was archived by the owner on Oct 1, 2019. It is now read-only.

html5 semantic tags + inline-svg = weird bug in old ie #66

Closed
@wheresrhys

Description

@wheresrhys

The following

<header><svg><path /></svg></header>

results in the header tag not closing in ie7 & 8 (even with the inclusion of html5shiv), whereas the following does not

<header><svg><path></path></svg></header>

So should self-closing tags within svgs (and, by extension, self-closing tags outside of the core html specs) be disallowed in favour of closing them explicitly? On the surface it seems like an edge case, but as we're taking a mobile first approach inline-svgs could become quite common and would tend to break layouts in ie without this stipulation

Activity

triblondon

triblondon commented on Dec 18, 2013

@triblondon
Contributor

Probably. Do we need an SVG coding standard? @richard-still-ft, do we have one anywhere in the FT at the moment?

triblondon

triblondon commented on Jan 10, 2014

@triblondon
Contributor
kavanagh

kavanagh commented on Jan 10, 2014

@kavanagh
Member

No one make's SVGs by hand. The tools that create SVGs use self closing tags. How annoying.

triblondon

triblondon commented on Jan 10, 2014

@triblondon
Contributor

What do we mean by 'old' here?

kavanagh

kavanagh commented on Jan 10, 2014

@kavanagh
Member
wheresrhys

wheresrhys commented on Jan 10, 2014

@wheresrhys
ContributorAuthor

Thinking about this, it may be a shortcoming of html5shiv. If html5shiv also created an element for each svg tag my guess is the bug would be fixed. I'll try it out sometime

triblondon

triblondon commented on Jan 10, 2014

@triblondon
Contributor

OK. This is an issue in IE8, since SVG would be part of supporting visual style and would need to work even in CTM-failing browsers. Worth digging a bit further.

wheresrhys

wheresrhys commented on Jan 28, 2014

@wheresrhys
ContributorAuthor

I've now tested out #66 (comment) and my hunch was right; the bug can be fixed by adding svg path to html5shiv's list of elements.

Currently html5shiv (which Modernizr consumes) allows redefining the list of elements, but doesn't allow just adding to it, so I created a pull request to achieve this aFarkas/html5shiv#142.

Whether we want to use this approach though is debatable as it's quite an unwieldy dependency to express: 'This module requires html5shiv or modernizr but with a, b, c additional tags added to the list of elements that are shived' - yuk!

triblondon

triblondon commented on Feb 10, 2014

@triblondon
Contributor

Can't we just make a build script where needed to expand self-closing paths into opening and closing tags?

triblondon

triblondon commented on Feb 18, 2014

@triblondon
Contributor
wheresrhys

wheresrhys commented on Feb 18, 2014

@wheresrhys
ContributorAuthor

A build script where? In build service/products, in which case its an extra overhead in adopting origami components (and an unpredictable one - update to a module version that starts using inline svg and suddenly your product's build needs a new step to process svgs).

Maybe the spec should say 'svgs must either not be inline or not use self-closing tags' I only used inline for ft-header as the ft logo is probably the thing that needs to load quickest anywhere, but for most other use cases an <img> or background image might do (although we then bring in the perennial problem of paths for img#src).

Longer term, have you seen the new bounty feature in github? Offering a bounty to have html5shiv updated to a better api (aFarkas/html5shiv#142), and pushing for modernizr to adopt something like 'if modernizr is testing for inlinesvg then also shiv all the svg tags' could enable us to stop worrying about this entirely.

6 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      html5 semantic tags + inline-svg = weird bug in old ie · Issue #66 · Financial-Times/ft-origami