Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit cbbe3bf

Browse files
committed
revert: fix(compiler): corrects component transclusion on ...
This reverts commit 15e1a29. 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.
1 parent 91e139e commit cbbe3bf

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/ng/compile.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ function $CompileProvider($provide) {
749749
newTemplateAttrs
750750
)
751751
);
752-
mergeTemplateAttributes(templateAttrs, newTemplateAttrs, directive.name);
752+
mergeTemplateAttributes(templateAttrs, newTemplateAttrs);
753753

754754
ii = directives.length;
755755
} else {
@@ -1007,16 +1007,15 @@ function $CompileProvider($provide) {
10071007
*
10081008
* @param {object} dst destination attributes (original DOM)
10091009
* @param {object} src source attributes (from the directive template)
1010-
* @param {string} ignoreName attribute which should be ignored
10111010
*/
1012-
function mergeTemplateAttributes(dst, src, ignoreName) {
1011+
function mergeTemplateAttributes(dst, src) {
10131012
var srcAttr = src.$attr,
10141013
dstAttr = dst.$attr,
10151014
$element = dst.$$element;
10161015

10171016
// reapply the old attributes to the new element
10181017
forEach(dst, function(value, key) {
1019-
if (key.charAt(0) != '$' && key != ignoreName) {
1018+
if (key.charAt(0) != '$') {
10201019
if (src[key]) {
10211020
value += (key === 'style' ? ';' : ' ') + src[key];
10221021
}
@@ -1031,7 +1030,7 @@ function $CompileProvider($provide) {
10311030
dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;
10321031
} else if (key == 'style') {
10331032
$element.attr('style', $element.attr('style') + ';' + value);
1034-
} else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key) && key != ignoreName) {
1033+
} else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {
10351034
dst[key] = value;
10361035
dstAttr[key] = srcAttr[key];
10371036
}
@@ -1074,7 +1073,7 @@ function $CompileProvider($provide) {
10741073
tempTemplateAttrs = {$attr: {}};
10751074
replaceWith($rootElement, $compileNode, compileNode);
10761075
collectDirectives(compileNode, directives, tempTemplateAttrs);
1077-
mergeTemplateAttributes(tAttrs, tempTemplateAttrs, origAsyncDirective.name);
1076+
mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
10781077
} else {
10791078
compileNode = beforeTemplateCompileNode;
10801079
$compileNode.html(content);

test/ng/compileSpec.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ describe('$compile', function() {
534534
expect(div.hasClass('log')).toBe(true);
535535
expect(div.css('width')).toBe('10px');
536536
expect(div.css('height')).toBe('20px');
537-
expect(div.attr('replace')).toEqual(undefined);
537+
expect(div.attr('replace')).toEqual('');
538538
expect(div.attr('high-log')).toEqual('');
539539
}));
540540

@@ -856,7 +856,7 @@ describe('$compile', function() {
856856
$rootScope.$digest();
857857

858858
expect(sortedHtml(element)).
859-
toEqual('<div><b class="hello"><span>Hello, Elvis!</span></b></div>');
859+
toEqual('<div><b class="hello"><span replace="">Hello, Elvis!</span></b></div>');
860860
}));
861861

862862

@@ -868,7 +868,7 @@ describe('$compile', function() {
868868
$rootScope.$digest();
869869

870870
expect(sortedHtml(element)).
871-
toEqual('<span>Hello, Elvis!</span>');
871+
toEqual('<span replace="">Hello, Elvis!</span>');
872872
}));
873873

874874

@@ -1077,7 +1077,7 @@ describe('$compile', function() {
10771077

10781078
var div = element.find('div');
10791079
expect(div.attr('i-first')).toEqual('');
1080-
expect(div.attr('i-second')).toEqual(undefined);
1080+
expect(div.attr('i-second')).toEqual('');
10811081
expect(div.attr('i-third')).toEqual('');
10821082
expect(div.attr('i-last')).toEqual('');
10831083

@@ -1127,7 +1127,7 @@ describe('$compile', function() {
11271127

11281128
var div = element.find('div');
11291129
expect(div.attr('i-first')).toEqual('');
1130-
expect(div.attr('i-second')).toEqual(undefined);
1130+
expect(div.attr('i-second')).toEqual('');
11311131
expect(div.attr('i-third')).toEqual('');
11321132
expect(div.attr('i-last')).toEqual('');
11331133

0 commit comments

Comments
 (0)