Skip to content

Add advice on how to handle className conflict in DOM? #298

Closed

Description

@BigBadaboom

Re: Interface SVGElement
https://svgwg.org/svg2-draft/single-page.html#types-InterfaceSVGElement

As far as I can tell, this is the first version of the spec since className was added to the Element interface in DOM level 2 (2002). SVGElement in SVG 1.2 Tiny didn't include className in its uDOM definition.

Should the spec provide guidance on how implementations should handle the conflict between SVGElement.className and Element.className?

Activity

  1. changed the title [-]Add advice on how to handle className conflict in DOM[/-] [+]Add advice on how to handle className conflict in DOM?[/+] on Dec 5, 2016
  2. AmeliaBR commented on Dec 8, 2016

    @AmeliaBR
    Contributor

    What I'd like to do is to have SVGElement.className act as a regular DOM string that has special properties .animVal and .baseVal that implement the old SVGAnimatedString behavior. See #175 for my musings about speccing that sort of behavior SVG-wide.

    In the short term, however, based on existing implementations, the guidance is more that "the .className property of SVGElement overrides the property of the same name on the Element interface".

    Of course, whether this is easy or hard to implement depends on the type-strictness of the language in which you're implementing the DOM.

  3. nikosandronikos commented on Dec 9, 2016

    @nikosandronikos
    Member

    Since SVGElement.className is deprecated. It would be nice if we could reverse the order of that and defer to Element.className if it exists.

  4. AmeliaBR commented on Dec 9, 2016

    @AmeliaBR
    Contributor

    Since SVGElement.className is deprecated. It would be nice if we could reverse the order of that and defer to Element.className if it exists.

    That wouldn't be backwards compatible, and doesn't get at the main issue: should implementers move their existing HTMLElement.classname implementations to be part of the core Element interface, or no? If we're saying they should, then SVGElement.classname isn't just deprecated, it's obsolete & any old SVG script references to it will be broken.

  5. AmeliaBR commented on Dec 22, 2016

    @AmeliaBR
    Contributor

    On the call today we agreed that--as much as we'd like a more compatible option--for now, we want to spec the current behavior. Meaning that the SVGElement definition of className would override the inherited definition from Element.

    @nikosandronikos has agreed to look into the WebIDL rules on overloading inherited properties to make sure that's allowed, and to add a short clarification/warning to the spec.

  6. added this to the milestone on Dec 22, 2016
  7. nikosandronikos commented on Dec 23, 2016

    @nikosandronikos
    Member

    The important text in WebIDL is:

    Interfaces may specify an interface member that has the same name as one from an inherited interface. Objects that implement the derived interface will expose the member on the derived interface. It is language binding specific whether the overridden member can be accessed on the object.

  8. added a commit that references this issue on Dec 23, 2016
    b625e5e
  9. AmeliaBR commented on Dec 23, 2016

    @AmeliaBR
    Contributor

    Thanks Nikos. Yes, I was confusing things by looking at the WebIDL section on overloading, instead of inheritance. Been too long since I've done worked with a traditional object-oriented language where overloading method signatures is a thing.

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions