mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
revert: fix(compiler): corrects component transclusion on ...
This reverts commit 15e1a29cd0.
The original commit was fixing two issues - one of them was
preventing attributes that triggered directives that replaced
the compiled node to be merged into the new node.
This change was a breaking change (as seen in the diff of the
tests in this commit) and that's why it's being removed.
A proper fix will follow.
This commit is contained in:
parent
91e139e52a
commit
cbbe3bfe91
2 changed files with 10 additions and 11 deletions
|
|
@ -749,7 +749,7 @@ function $CompileProvider($provide) {
|
|||
newTemplateAttrs
|
||||
)
|
||||
);
|
||||
mergeTemplateAttributes(templateAttrs, newTemplateAttrs, directive.name);
|
||||
mergeTemplateAttributes(templateAttrs, newTemplateAttrs);
|
||||
|
||||
ii = directives.length;
|
||||
} else {
|
||||
|
|
@ -1007,16 +1007,15 @@ function $CompileProvider($provide) {
|
|||
*
|
||||
* @param {object} dst destination attributes (original DOM)
|
||||
* @param {object} src source attributes (from the directive template)
|
||||
* @param {string} ignoreName attribute which should be ignored
|
||||
*/
|
||||
function mergeTemplateAttributes(dst, src, ignoreName) {
|
||||
function mergeTemplateAttributes(dst, src) {
|
||||
var srcAttr = src.$attr,
|
||||
dstAttr = dst.$attr,
|
||||
$element = dst.$$element;
|
||||
|
||||
// reapply the old attributes to the new element
|
||||
forEach(dst, function(value, key) {
|
||||
if (key.charAt(0) != '$' && key != ignoreName) {
|
||||
if (key.charAt(0) != '$') {
|
||||
if (src[key]) {
|
||||
value += (key === 'style' ? ';' : ' ') + src[key];
|
||||
}
|
||||
|
|
@ -1031,7 +1030,7 @@ function $CompileProvider($provide) {
|
|||
dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;
|
||||
} else if (key == 'style') {
|
||||
$element.attr('style', $element.attr('style') + ';' + value);
|
||||
} else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key) && key != ignoreName) {
|
||||
} else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {
|
||||
dst[key] = value;
|
||||
dstAttr[key] = srcAttr[key];
|
||||
}
|
||||
|
|
@ -1074,7 +1073,7 @@ function $CompileProvider($provide) {
|
|||
tempTemplateAttrs = {$attr: {}};
|
||||
replaceWith($rootElement, $compileNode, compileNode);
|
||||
collectDirectives(compileNode, directives, tempTemplateAttrs);
|
||||
mergeTemplateAttributes(tAttrs, tempTemplateAttrs, origAsyncDirective.name);
|
||||
mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
|
||||
} else {
|
||||
compileNode = beforeTemplateCompileNode;
|
||||
$compileNode.html(content);
|
||||
|
|
|
|||
|
|
@ -534,7 +534,7 @@ describe('$compile', function() {
|
|||
expect(div.hasClass('log')).toBe(true);
|
||||
expect(div.css('width')).toBe('10px');
|
||||
expect(div.css('height')).toBe('20px');
|
||||
expect(div.attr('replace')).toEqual(undefined);
|
||||
expect(div.attr('replace')).toEqual('');
|
||||
expect(div.attr('high-log')).toEqual('');
|
||||
}));
|
||||
|
||||
|
|
@ -856,7 +856,7 @@ describe('$compile', function() {
|
|||
$rootScope.$digest();
|
||||
|
||||
expect(sortedHtml(element)).
|
||||
toEqual('<div><b class="hello"><span>Hello, Elvis!</span></b></div>');
|
||||
toEqual('<div><b class="hello"><span replace="">Hello, Elvis!</span></b></div>');
|
||||
}));
|
||||
|
||||
|
||||
|
|
@ -868,7 +868,7 @@ describe('$compile', function() {
|
|||
$rootScope.$digest();
|
||||
|
||||
expect(sortedHtml(element)).
|
||||
toEqual('<span>Hello, Elvis!</span>');
|
||||
toEqual('<span replace="">Hello, Elvis!</span>');
|
||||
}));
|
||||
|
||||
|
||||
|
|
@ -1077,7 +1077,7 @@ describe('$compile', function() {
|
|||
|
||||
var div = element.find('div');
|
||||
expect(div.attr('i-first')).toEqual('');
|
||||
expect(div.attr('i-second')).toEqual(undefined);
|
||||
expect(div.attr('i-second')).toEqual('');
|
||||
expect(div.attr('i-third')).toEqual('');
|
||||
expect(div.attr('i-last')).toEqual('');
|
||||
|
||||
|
|
@ -1127,7 +1127,7 @@ describe('$compile', function() {
|
|||
|
||||
var div = element.find('div');
|
||||
expect(div.attr('i-first')).toEqual('');
|
||||
expect(div.attr('i-second')).toEqual(undefined);
|
||||
expect(div.attr('i-second')).toEqual('');
|
||||
expect(div.attr('i-third')).toEqual('');
|
||||
expect(div.attr('i-last')).toEqual('');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue