-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Adding missing 'element' and 'content' tags #140
Comments
While API could be indeed better, why don't you use the elements-option? |
The elements option makes perfect sense for custom elements, but IMO standard elements like "element" or "content" should be supported by default. Why shouldn't you support them by default? |
I didn't said, that I won't add it. I just asked, because you said, that you are using a customized version instead of using the API to extend it. |
I guess I'll adjust my approach by the time the project is released depending on whether or not you have added the new tags to the HTMLshiv by then. If you have, I could just use the latest version of the shiv. If not, elements-option is probably a better approach than "hacking" the source code... Nevertheless, I feel like being forced to choose between the elements-option and "hacking" the source code is choosing the lesser of two evils... so I'm really, really looking forward to seeing both tags added to the official source code and not having to consider making that choice :-) |
@jslegers, it would be nice to see an implementation. Would you share an example of where this does not work in IE≤8, but does after the shiv? For instance, the Object.defineProperty(HTMLGenericElement.prototype, 'content', {
get: function () {
var self = this;
if (self.nodeName === 'template') {
for (var frag = document.createDocumentFragment(), childNodes = self.childNodes, index = 0, length = childNodes.length; index < length; ++index) {
frag.appendChild(childNodes[index].cloneNode(true));
}
return frag;
}
}
}); Also, in the spec you've referenced, they are using a Object.defineProperty(Element.prototype, 'textContent', {
get: function () {
return this.innerText;
},
set: function (value) {
this.innerText = value;
}
}); |
I'm not trying to polyfill web components but rather create an abstraction layer that implements behavior of web components in a cross-browser fashion, using the traditional DOM instead of the shadow DOM. I guess you could say the project is intended to relate to web components the same way Sizzle relates to At this early stage, I'm using the following syntax : template.setTemplate('t')
.applyTemplate(document.getElementById('news'))
.setTemplate('u')
.applyTemplate(document.getElementById('ticker')); This code first fetches a template with I'm currently at a stage where I can read inline templates and process For now, I'd like to keep my code private, although I am planning to publish it open source once it's ready. |
The HTML5 shiv does support the 'template' tag, which is a tag that (to my knowledge) is used exclusively in web components.
Web components have other new tags, though. More specificly, I'm thinking of the 'element' and 'content' tags. These are currently not included in the HTML5 shiv.
Could you please add support for the 'element' and 'content' tags to the HTML5 shiv? I'm currently working on an open source js framework / library that - among other things - emulates some behavior of web components. To support those features in old IE, I need the HTML5shiv to support these new tags along with the 'template' tag.
For the development of my project, I'm currently using a 'custom' version of the HTML5 shiv where I added these tags myself, but I'd prefer to use the official version and bet others might be interested in this addition as well.
More info on web components : http://www.w3.org/TR/components-intro/
The text was updated successfully, but these errors were encountered: