With x-tag I am trying to find a way to extend every html element that I put is:"ajax-pop"
attribute.
What I want to do is when I click an element with is:"ajax-pop" attribute I will do some dynamic ajax loads. It will be a good starting point for me to develop a manageble system.
I know I can do it with some different ways but I am wondering is there a way to do it like this way extends:'every single native html element'
xtag.register('ajax-pop', {
extends: 'WHAT SHOULD I WRITE HERE???',
lifecycle: {
created: function () {
},
inserted: function () {
},
removed: function () { },
attributeChanged: function () { }
},
methods: {
someMethod: function () { }
},
accessors: {
popUrp: {
attribute: {
name: "pop-url"
}
},
},
events: {
tap: function () { },
focus: function () { }
}
});
You can do this using x-tag's
delegate
pseudo, and by adding adata-
attribute to elements you wish to have this behavior:<article data-pop="/path/to/content.html"></article>
And your JavaScript would be something like this:
Here's a codepen example: http://codepen.io/jpecor-pmi/pen/Vexqyg