mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Removed support for nested tags (nested attributes solves the same problem)
This commit is contained in:
parent
255297f36e
commit
ef4cdf65df
@ -96,7 +96,6 @@ Taglib.Tag = function () {
|
||||
this.transformers = {};
|
||||
this.nestedVariables = {};
|
||||
this.importedVariables = {};
|
||||
this.nestedTags = {};
|
||||
this.staticProperties = {};
|
||||
this.patternAttributes = [];
|
||||
|
||||
@ -131,15 +130,6 @@ Taglib.Tag = function () {
|
||||
});
|
||||
subTag.patternAttributes = superTag.patternAttributes.concat(subTag.patternAttributes);
|
||||
},
|
||||
addNestedTag: function (nestedTag) {
|
||||
var namespace = nestedTag.namespace || '';
|
||||
this.nestedTags[namespace + ':' + nestedTag.name] = nestedTag;
|
||||
},
|
||||
forEachNestedTag: function (callback, thisObj) {
|
||||
forEachEntry(this.nestedTags, function (key, nestedTag) {
|
||||
callback.call(thisObj, nestedTag);
|
||||
});
|
||||
},
|
||||
forEachVariable: function (callback, thisObj) {
|
||||
forEachEntry(this.nestedVariables, function (key, variable) {
|
||||
callback.call(thisObj, variable);
|
||||
|
||||
@ -93,11 +93,6 @@ TaglibLookup.prototype = {
|
||||
}, this);
|
||||
}
|
||||
|
||||
tag.forEachNestedTag(function (nestedTag) {
|
||||
var nestedTagNS = resolveNamespaceWithDefault(nestedTag.namespace);
|
||||
this.nestedTags[tagNS + ':' + tag.name + ':' + nestedTagNS + ':' + nestedTag.name] = nestedTag;
|
||||
}, this);
|
||||
|
||||
tag.forEachAttribute(function (attr) {
|
||||
var attrNS = resolveNamespaceWithDefault(attr.namespace);
|
||||
if (attrNS === tagNS) {
|
||||
|
||||
@ -301,28 +301,6 @@ TaglibXmlLoader.prototype = {
|
||||
'type': { _type: STRING },
|
||||
'value': { _type: STRING }
|
||||
},
|
||||
'<nested-tag>': {
|
||||
_type: OBJECT,
|
||||
_begin: function () {
|
||||
return new Tag();
|
||||
},
|
||||
_end: function (nestedTag, tag) {
|
||||
if (nestedTag.namespace === null || nestedTag.namespace === undefined) {
|
||||
nestedTag.namespace = taglib.namespace;
|
||||
}
|
||||
nestedTag.targetProperty = nestedTag.targetProperty || nestedTag.name;
|
||||
if (!nestedTag.name) {
|
||||
throw createError(new Error('The "name" property is required for a <nested-tag>'));
|
||||
}
|
||||
tag.addNestedTag(nestedTag);
|
||||
},
|
||||
'name': { _type: STRING },
|
||||
'type': { _type: STRING },
|
||||
'target-property': {
|
||||
_type: STRING,
|
||||
_targetProp: 'targetProperty'
|
||||
}
|
||||
},
|
||||
'nested-variable': variableHandler,
|
||||
'variable': variableHandler,
|
||||
'imported-variable': importVariableHandler,
|
||||
|
||||
@ -324,11 +324,7 @@ describe('raptor-templates' , function() {
|
||||
|
||||
// });
|
||||
|
||||
it("should allow for nested tags", function(done) {
|
||||
testRender("test-project/test-templates/nested-tags.rhtml", {}, done);
|
||||
});
|
||||
|
||||
it("should allow for nested attributes", function(done) {
|
||||
it.only("should allow for nested attributes", function(done) {
|
||||
testRender("test-project/test-templates/nested-attrs.rhtml", {active: true}, done);
|
||||
});
|
||||
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
<c:template
|
||||
xmlns:c="http://raptorjs.org/templates/core"
|
||||
xmlns:test="http://raptorjs.org/templates/test"
|
||||
params="showConditionalTab">
|
||||
|
||||
<test:popover>
|
||||
<test:popover-title>Popover Title</test:popover-title>
|
||||
<test:popover-content>
|
||||
Popover Content
|
||||
</test:popover-content>
|
||||
Link Text
|
||||
</test:popover>
|
||||
<test:popover title="Popover Title" content="Popover Content">
|
||||
Link Text
|
||||
</test:popover>
|
||||
|
||||
</c:template>
|
||||
@ -1 +0,0 @@
|
||||
<span title="Popover Title" data-content="Popover Content">Link Text</span><span title="Popover Title" data-content="Popover Content">Link Text</span>
|
||||
Loading…
x
Reference in New Issue
Block a user