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

Commit 8927c94

Browse files
Michel BoudreauNarretz
Michel Boudreau
authored andcommitted
fix(ngJq): don't rely on jqlite
1 parent 3bc429a commit 8927c94

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
@@ -943,18 +943,15 @@ var csp = function() {
943943
var jq = function() {
944944
if (isDefined(jq.name_)) return jq.name_;
945945
var el;
946-
var i, ii = ngAttrPrefixes.length;
946+
var i, ii = ngAttrPrefixes.length, prefix, name;
947947
for (i = 0; i < ii; ++i) {
948-
if (el = document.querySelector('[' + ngAttrPrefixes[i].replace(':', '\\:') + 'jq]')) {
948+
prefix = ngAttrPrefixes[i];
949+
if (el = document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]')) {
950+
name = el.getAttribute(prefix + 'jq');
949951
break;
950952
}
951953
}
952954

953-
var name;
954-
if (el) {
955-
name = getNgAttribute(el, "jq");
956-
}
957-
958955
return (jq.name_ = name);
959956
};
960957

@@ -1195,10 +1192,9 @@ var ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-'];
11951192

11961193
function getNgAttribute(element, ngAttr) {
11971194
var attr, i, ii = ngAttrPrefixes.length;
1198-
element = jqLite(element);
11991195
for (i = 0; i < ii; ++i) {
12001196
attr = ngAttrPrefixes[i] + ngAttr;
1201-
if (isString(attr = element.attr(attr))) {
1197+
if (isString(attr = element.getAttribute(attr))) {
12021198
return attr;
12031199
}
12041200
}

0 commit comments

Comments
 (0)