Skip to content

Commit 8a1364a

Browse files
authored
Merge pull request #105 from dkamburov/master
Fix for internal issue #234087. Remove configuration attributes from …
2 parents 77c7375 + edce7d9 commit 8a1364a

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

src/igniteui-angular.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -724,10 +724,6 @@
724724
if (context) {
725725
var options = scope.$eval(attrs[ controlName ]) ||
726726
extractOptions(controlName, context, {}, element, scope);
727-
/* removing the width and height attributes on the placeholder, because they affect the control dimensions */
728-
if (element.removeAttr) {
729-
element.removeAttr("width").removeAttr("height");
730-
}
731727

732728
if (attrs.source) {
733729
options.dataSource = scope.$eval(attrs.source);
@@ -753,7 +749,22 @@
753749
}
754750
});
755751

752+
/* removing the width and height attributes on the placeholder, because they affect the control dimensions
753+
remove other attributes too, they may confront with some html5 attributes for example draggable
754+
D.K. fix for bug #234087
755+
*/
756+
for (var a in attrs) {
757+
if (a !== "id" &&
758+
!a.startsWith("$") &&
759+
!a.startsWith("data-") &&
760+
!a.startsWith("ng-") &&
761+
element.removeAttr) {
762+
element.removeAttr(a.replace(/([A-Z])/g, "-$1").toLowerCase());
763+
}
764+
}
765+
756766
element[ controlName ](options);
767+
757768
}
758769
}
759770
};

test/e2e/scenarios.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,14 @@ describe("my app", function() {
572572
//the other values should be preserved
573573
expect(util.getResult('$("#grid1 tbody tr:eq(1) td")[2].innerHTML'))
574574
.toBe(util.getResult('angular.element("#grid1").scope().northwind[1].UnitsOnOrder.toString()'));
575+
expect(util.getResult('$("#grid1").attr("width")'))
576+
.toBe(null);
577+
expect(util.getResult('$("#grid1").attr("height")'))
578+
.toBe(null);
579+
expect(util.getResult('$("#grid1").attr("auto-commit")'))
580+
.toBe(null);
581+
expect(util.getResult('$("#grid1").attr("primary-key")'))
582+
.toBe(null);
575583
});
576584

577585
it("should apply column template correctly", function () {

test/unit/directiveSpecs.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe("Ignite directives", function() {
6161
}));
6262

6363
it("should create dialog", inject(function($compile, $rootScope) {
64-
var dialogTpl ='<ig-dialog id="dialog1" header-text="Foo" height="325px"><content>' +
64+
var dialogTpl ='<ig-dialog id="dialog1" header-text="Foo" height="325px" draggable="true"><content>' +
6565
'<p><img style="width: 220px" src="http://www.igniteui.com/images/samples/dialog-window/content.jpg" /></p><input style="margin: 5px" /></content>' +
6666
'</ig-dialog>';
6767
var dialog = angular.element('<div ng-app="my-app"><div ng-controller="NorthwindCtrl">' + dialogTpl + '</div>');
@@ -73,6 +73,8 @@ describe("Ignite directives", function() {
7373
expect(img.length).toBe(1);
7474
expect(dialogElement.length).toBe(1);
7575
expect(dialogElement.data("igDialog")).not.toBeUndefined();
76+
expect(dialogElement.attr("draggable")).toBeUndefined();
77+
expect(dialogElement.attr("height")).toBeUndefined();
7678
}));
7779

7880
it("should create dialog with nested controls", inject(function($compile, $rootScope) {

0 commit comments

Comments
 (0)