Removed support for nested tags (nested attributes solves the same problem)

This commit is contained in:
Patrick Steele-Idem 2014-02-05 12:44:57 -07:00
parent 255297f36e
commit ef4cdf65df
6 changed files with 1 additions and 60 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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,

View File

@ -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);
});

View File

@ -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>

View File

@ -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>