-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify how user agents should implement vendor-specific extensions #53
Comments
I would be ok adding a recommendation that if authoring tools use I'm also okay linking to the HTML text on an You could also simply use the Mostly this just makes me sad that HTML gave up on custom XML namespaces when all that was needed was for the default namespace to apply automatically based on doctype. |
I was just told by Ian Hickson on implementors@lists.whatwg.org that data-* attributes would be inappropriate for this purpose because they are meant for authors. The HTML 5 spec says that "User agents must not derive any implementation behaviour from these (data-) attributes or values." I think recommending data-vendor- attributes here would be against the HTML 5 spec. While using vendor:* attributes would make the document non-conforming just like x-vendor-* attributes, the former feel a lot more inconsistent and confusing (is this XML or HTML? Should I use getAttribute() or getAttributeNS()?). I think the x-vendor-* approach is the best one because it is consistent with HTML 5 and it makes it easy to strip the vendor data from the document and make it fully conformant if user prefers so. Authoring tools could implement two separate export options, one for stripping vendor data which would remove all x-* attributes and one for stripping user data which would remove all data-* attributes. |
That gloss of the reasoning behind What's not supposed to be allowed is using It's fine to use them to store information that your tool generates and uses for its own purposes. The only downside is that the names can potentially clash with ones the author is using, but that's true of literally every usage except code that the author hand-writes. Just vendor-prefix your names and you'll be fine. |
The important thing is that a user agent displaying content does not do anything with a Authoring tools are somewhat different. You could even argue that they count as "author" too. But I don't want to get into an argument with HTML editors on that point. Perhaps we could point to the section on Aside: should the section on foreign namespaces & private data be moved to the Structure chapter, next to the |
From my understanding of the spec there are two types of data that can be attached to an element:
I'm going to read the related spec sections again as I'm still not sure whether I understand things correctly. |
@jarek-foksa From the examples you've given, data-bx-* (though I think something more unique than 'bx' would be better) seems the most appropriate (as others have said). @AmeliaBR That chapter is about more than just foreignObject though.
Most of what is in the 'Foreign namespaces and private data' section seems to fit that definition. But I do agree that there should be some connection between that section and data attributes. Maybe it should be the data attribute section that is moved? (We should make a new issue if this is going to result in lots of discussion). |
data attributes are now defined via the HTMLOrSVGElement mixin in HTML rather than in SVG, so any advice or requirements should be in that spec (also tools can also author HTML like Macromedia Dreamweaver so advice should probably be consistent between the two markup languages). As such I don't think this requires an edit on our side. Feel free to reopen if you disagree. |
I'm building an SVG editor that allows users to save SVG documents using either XML or HTML 5 serialization.
In order to preserve editing capabilities I need to store app-specific data as content attributes. For example, when user draws a star path, I want to preserve the information about the number of arms, the inner radius and the outer radius of the star.
When using XML serialization, the obvious solution is to use custom namespace:
However, I'm not sure how the corresponding markup should look like when using HTML 5 serialization. Should I use data-* attributes?
... or data-vendor-* attributes?
... or x-vendor-* attributes?
The data-* approach is very likely going to cause clashes when the file is opened with another editor.
The data-vendor-* approach does not seem to be mentioned in either HTML 5 or SVG 2 spec.
The x-vendor-* approach seems to be what the HTML 5 spec recommends, but it's not mentioned by the SVG 2 spec.
I would propose to update the SVG 2 spec to explicitly state what is the preferred approach here, so that various SVG editors could generate files with consistent sytnax. Ideally, just reference the corresponding section in the HTML 5 spec.
The text was updated successfully, but these errors were encountered: