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

Commit 342e5f3

Browse files
Michel Boudreaupetebacondarwin
Michel Boudreau
authored andcommitted
fix(ngJq): don't rely on jqlite
Closes #11044
1 parent 44e9d2c commit 342e5f3

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/Angular.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -993,18 +993,15 @@ var csp = function() {
993993
var jq = function() {
994994
if (isDefined(jq.name_)) return jq.name_;
995995
var el;
996-
var i, ii = ngAttrPrefixes.length;
996+
var i, ii = ngAttrPrefixes.length, prefix, name;
997997
for (i = 0; i < ii; ++i) {
998-
if (el = document.querySelector('[' + ngAttrPrefixes[i].replace(':', '\\:') + 'jq]')) {
998+
prefix = ngAttrPrefixes[i];
999+
if (el = document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]')) {
1000+
name = el.getAttribute(prefix + 'jq');
9991001
break;
10001002
}
10011003
}
10021004

1003-
var name;
1004-
if (el) {
1005-
name = getNgAttribute(el, "jq");
1006-
}
1007-
10081005
return (jq.name_ = name);
10091006
};
10101007

@@ -1265,10 +1262,9 @@ var ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-'];
12651262

12661263
function getNgAttribute(element, ngAttr) {
12671264
var attr, i, ii = ngAttrPrefixes.length;
1268-
element = jqLite(element);
12691265
for (i = 0; i < ii; ++i) {
12701266
attr = ngAttrPrefixes[i] + ngAttr;
1271-
if (isString(attr = element.attr(attr))) {
1267+
if (isString(attr = element.getAttribute(attr))) {
12721268
return attr;
12731269
}
12741270
}

0 commit comments

Comments
 (0)