role-rails 0.4.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/role-rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.role.js +28 -140
- data/vendor/assets/javascripts/role.js +19 -0
- metadata +5 -4
data/lib/role-rails/version.rb
CHANGED
@@ -1,141 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
var i = 0,
|
28
|
-
ret = results || [];
|
29
|
-
if ( toString.call(array) === "[object Array]" ) {
|
30
|
-
Array.prototype.push.apply( ret, array );
|
31
|
-
} else {
|
32
|
-
if ( typeof array.length === "number" ) {
|
33
|
-
for ( var l = array.length; i < l; i++ ) {
|
34
|
-
ret.push( array[i] );
|
35
|
-
}
|
36
|
-
} else {
|
37
|
-
for ( ; array[i]; i++ ) {
|
38
|
-
ret.push( array[i] );
|
39
|
-
}
|
40
|
-
}
|
41
|
-
}
|
42
|
-
return ret;
|
43
|
-
};
|
44
|
-
}
|
45
|
-
|
46
|
-
var oldFind = $.find;
|
47
|
-
$.find = function( query, context, extra, seed ) {
|
48
|
-
context = context || document;
|
49
|
-
if ( !seed && !$.find.isXML(context) ) {
|
50
|
-
var match = /^@([\w\-]+$)/.exec( query );
|
51
|
-
if ( match ) {
|
52
|
-
if ( context.nodeType === 9 ) {
|
53
|
-
return makeArray( context.querySelectorAll('[role~='+match[1]+']'), extra );
|
54
|
-
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
|
55
|
-
var oldContext = context,
|
56
|
-
old = context.getAttribute( "id" ),
|
57
|
-
nid = old || id,
|
58
|
-
hasParent = context.parentNode,
|
59
|
-
relativeHierarchySelector = /^\s*[+~]/.test( query );
|
60
|
-
if ( !old ) {
|
61
|
-
context.setAttribute( "id", nid );
|
62
|
-
} else {
|
63
|
-
nid = nid.replace( /'/g, "\\$&" );
|
64
|
-
}
|
65
|
-
if ( relativeHierarchySelector && hasParent ) {
|
66
|
-
context = context.parentNode;
|
67
|
-
}
|
68
|
-
try {
|
69
|
-
if ( !relativeHierarchySelector || hasParent ) {
|
70
|
-
return makeArray( context.querySelectorAll( "[id='" + nid + "'] [role~='" + match[1] + "']" ), extra );
|
71
|
-
}
|
72
|
-
} catch(pseudoError) {
|
73
|
-
} finally {
|
74
|
-
if ( !old ) {
|
75
|
-
oldContext.removeAttribute( "id" );
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
}
|
80
|
-
return oldFind(query, context, extra, seed);
|
81
|
-
}
|
82
|
-
}
|
83
|
-
|
84
|
-
// Add jQuery.find.* properties to new find
|
85
|
-
for ( var prop in oldFind ) {
|
86
|
-
$.find[ prop ] = oldFind[ prop ];
|
87
|
-
}
|
88
|
-
|
89
|
-
// Save original of matchesSelector
|
90
|
-
var _oldMatchesSelector = $.find.matchesSelector;
|
91
|
-
$.find.matchesSelector = function (node, expr) {
|
92
|
-
return _oldMatchesSelector(
|
93
|
-
node,
|
94
|
-
expr.replace(/(@[\w\-]+)/g, function ($0) {
|
95
|
-
return $0.replace(/^@([\w\-]+)$/, function ($0, $1) {
|
96
|
-
return '[role="' + $1 + '"]';
|
97
|
-
});
|
98
|
-
})
|
99
|
-
)
|
100
|
-
}
|
101
|
-
}
|
102
|
-
}
|
103
|
-
|
104
|
-
$.expr.match['ROLE'] = /@((?:[\w\u00c0-\uFFFF\-]|\\.)+)/;
|
105
|
-
|
106
|
-
$.expr.preFilter['ROLE'] = function( match, curLoop, inplace, result, not, isXML ) {
|
107
|
-
match = " " + match[1] + " ";
|
108
|
-
|
109
|
-
return match;
|
110
|
-
}
|
111
|
-
|
112
|
-
$.expr.filter['ROLE'] = function( elem, match ) {
|
113
|
-
return (" " + elem.getAttribute('role') + " ").indexOf( match ) > -1;
|
114
|
-
}
|
115
|
-
|
116
|
-
for ( var type in $.expr.match ) {
|
117
|
-
$.expr.match[ type ] = new RegExp( $.expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
|
118
|
-
$.expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + $.expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num) {
|
119
|
-
return "\\" + (num - 0 + 1);
|
120
|
-
}));
|
121
|
-
}
|
122
|
-
|
123
|
-
initSizzleNewLayer();
|
124
|
-
|
125
|
-
$.role = function (roleName, context) {
|
126
|
-
|
127
|
-
var selector;
|
128
|
-
|
129
|
-
if ( roleName.charAt(0) === '#' ) {
|
130
|
-
selector = '#role-' + roleName.substring(1);
|
131
|
-
} else {
|
132
|
-
selector = '[role="' + roleName + '"]';
|
133
|
-
}
|
134
|
-
|
135
|
-
return $(selector, context);
|
1
|
+
// Role.js, jQuery adapter v1.0.0 ~ https://github.com/kossnocorp/role
|
2
|
+
|
3
|
+
(function($) {
|
4
|
+
var matchesSelectorOrigin, type;
|
5
|
+
if ($ == null) $ = jQuery;
|
6
|
+
$.expr.match['ROLE'] = /@((?:[\w\u00c0-\uFFFF\-]|\\.)+)/;
|
7
|
+
$.expr.preFilter['ROLE'] = function(match) {
|
8
|
+
return ' ' + match[1] + ' ';
|
9
|
+
};
|
10
|
+
$.expr.filter['ROLE'] = function(el, match) {
|
11
|
+
return (" " + (el.getAttribute('role')) + " ").indexOf(match) !== -1;
|
12
|
+
};
|
13
|
+
for (type in $.expr.match) {
|
14
|
+
$.expr.match[type] = new RegExp($.expr.match[type].source + /(?![^\[]*\])(?![^\(]*\))/.source);
|
15
|
+
$.expr.leftMatch[type] = new RegExp(/(^(?:.|\r|\n)*?)/.source + $.expr.match[type].source.replace(/\\(\d+)/g, function(all, num) {
|
16
|
+
return "\\" + (num - 0 + 1);
|
17
|
+
}));
|
18
|
+
}
|
19
|
+
if (!(document.documentElement.matchesSelector != null) && (document.documentElement.mozMatchesSelector != null)) {
|
20
|
+
matchesSelectorOrigin = $.find.matchesSelector;
|
21
|
+
return $.find.matchesSelector = function(node, expr) {
|
22
|
+
return matchesSelectorOrigin(node, expr.replace(/(@[\w\-]+)/g, function($0) {
|
23
|
+
return $0.replace(/^@([\w\-]+)$/, function(__, $1) {
|
24
|
+
return "[role=\"" + $1 + "\"]";
|
25
|
+
});
|
26
|
+
}));
|
136
27
|
};
|
137
|
-
|
138
|
-
|
139
|
-
$.r = $.role;
|
140
|
-
}
|
141
|
-
})(jQuery);
|
28
|
+
}
|
29
|
+
})($);
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// Role.js, extension for querySelectorAll function v1.0.0 ~ https://github.com/kossnocorp/role
|
2
|
+
|
3
|
+
(function() {
|
4
|
+
var elm, _fn, _i, _len, _ref;
|
5
|
+
|
6
|
+
_ref = [Document, Element];
|
7
|
+
_fn = function(elm) {
|
8
|
+
var nativeQuery;
|
9
|
+
nativeQuery = elm.prototype.querySelectorAll;
|
10
|
+
return elm.prototype.querySelectorAll = function(selector) {
|
11
|
+
return nativeQuery.call(this, selector.replace(/@(\w+)/g, "[role~=\"$1\"]"));
|
12
|
+
};
|
13
|
+
};
|
14
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
15
|
+
elm = _ref[_i];
|
16
|
+
_fn(elm);
|
17
|
+
}
|
18
|
+
|
19
|
+
}).call(this);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: role-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70361255124280 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70361255124280
|
25
25
|
description: jQuery plugin to provide easy way to handle DOM elements by role attribute
|
26
26
|
email:
|
27
27
|
- koss@nocorp.me
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- role-rails-0.3.2/metadata.gz
|
50
50
|
- role-rails.gemspec
|
51
51
|
- vendor/assets/javascripts/jquery.role.js
|
52
|
+
- vendor/assets/javascripts/role.js
|
52
53
|
homepage: ''
|
53
54
|
licenses: []
|
54
55
|
post_install_message:
|