ende 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/component.json +2 -2
- data/components/component/bind/{0.0.1 → 1.0.0}/component.json +1 -1
- data/components/component/bind/{0.0.1 → 1.0.0}/index.js +1 -2
- data/components/component/jquery/1.0.0/component.json +10 -0
- data/components/component/jquery/1.0.0/index.js +10308 -0
- data/components/component/matches-selector/{0.1.2 → 0.1.4}/component.json +1 -1
- data/components/component/matches-selector/{0.1.2 → 0.1.4}/index.js +0 -0
- data/components/indefinido/advisable/master/component.json +1 -1
- data/components/indefinido/indemma/master/component.json +4 -7
- data/components/indefinido/indemma/master/lib/record.js +7 -2
- data/components/indefinido/indemma/master/lib/record/dirtyable.js +15 -6
- data/components/indefinido/indemma/master/lib/record/scopable.js +1 -1
- data/components/indefinido/observable/es6-modules/component.json +1 -1
- data/components/indefinido/observable/es6-modules/lib/legacy/schedulerable.js +8 -3
- data/components/indefinido/observable/es6-modules/lib/observable.js +0 -1
- data/components/indefinido/observable/es6-modules/lib/observable/observation.js +2 -2
- data/components/paulmillr/es6-shim/{0.10.1 → 0.14.0}/component.json +1 -1
- data/components/paulmillr/es6-shim/{0.10.1 → 0.14.0}/es6-shim.js +151 -102
- data/components/pluma/assimilate/{0.3.0 → 0.4.0}/component.json +2 -2
- data/components/pluma/assimilate/{0.3.0 → 0.4.0}/dist/assimilate.js +1 -1
- data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +12 -6
- data/lib/assets/javascripts/config/load_components.js.coffee +1 -1
- data/lib/assets/javascripts/ende.js.coffee +1 -1
- data/lib/ende/version.rb +1 -1
- data/vendor/assets/component/build.css +112 -0
- data/vendor/assets/components/ende_build.js +20357 -19584
- metadata +13 -84
- data/components/chaijs/assertion-error/1.0.0/component.json +0 -18
- data/components/chaijs/assertion-error/1.0.0/index.js +0 -110
- data/components/chaijs/chai/1.9.1/.gitignore +0 -22
- data/components/chaijs/chai/1.9.1/.mailmap +0 -1
- data/components/chaijs/chai/1.9.1/.npmignore +0 -14
- data/components/chaijs/chai/1.9.1/.travis.yml +0 -14
- data/components/chaijs/chai/1.9.1/CONTRIBUTING.md +0 -173
- data/components/chaijs/chai/1.9.1/History.md +0 -895
- data/components/chaijs/chai/1.9.1/Makefile +0 -93
- data/components/chaijs/chai/1.9.1/README.md +0 -99
- data/components/chaijs/chai/1.9.1/ReleaseNotes.md +0 -482
- data/components/chaijs/chai/1.9.1/bower.json +0 -27
- data/components/chaijs/chai/1.9.1/chai.js +0 -4782
- data/components/chaijs/chai/1.9.1/component.json +0 -50
- data/components/chaijs/chai/1.9.1/index.js +0 -1
- data/components/chaijs/chai/1.9.1/karma.conf.js +0 -28
- data/components/chaijs/chai/1.9.1/karma.sauce.js +0 -41
- data/components/chaijs/chai/1.9.1/lib/chai.js +0 -87
- data/components/chaijs/chai/1.9.1/lib/chai/assertion.js +0 -130
- data/components/chaijs/chai/1.9.1/lib/chai/config.js +0 -50
- data/components/chaijs/chai/1.9.1/lib/chai/core/assertions.js +0 -1314
- data/components/chaijs/chai/1.9.1/lib/chai/interface/assert.js +0 -1056
- data/components/chaijs/chai/1.9.1/lib/chai/interface/expect.js +0 -12
- data/components/chaijs/chai/1.9.1/lib/chai/interface/should.js +0 -78
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addChainableMethod.js +0 -111
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addMethod.js +0 -43
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addProperty.js +0 -40
- data/components/chaijs/chai/1.9.1/lib/chai/utils/flag.js +0 -32
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getActual.js +0 -18
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getEnumerableProperties.js +0 -25
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getMessage.js +0 -49
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getName.js +0 -20
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getPathValue.js +0 -102
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js +0 -35
- data/components/chaijs/chai/1.9.1/lib/chai/utils/index.js +0 -114
- data/components/chaijs/chai/1.9.1/lib/chai/utils/inspect.js +0 -320
- data/components/chaijs/chai/1.9.1/lib/chai/utils/objDisplay.js +0 -49
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteChainableMethod.js +0 -53
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteMethod.js +0 -51
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteProperty.js +0 -54
- data/components/chaijs/chai/1.9.1/lib/chai/utils/test.js +0 -26
- data/components/chaijs/chai/1.9.1/lib/chai/utils/transferFlags.js +0 -44
- data/components/chaijs/chai/1.9.1/lib/chai/utils/type.js +0 -45
- data/components/chaijs/chai/1.9.1/package.json +0 -42
- data/components/chaijs/chai/1.9.1/sauce.browsers.js +0 -128
- data/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_block.sh +0 -7
- data/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_setup.sh +0 -53
- data/components/chaijs/chai/1.9.1/test/assert.js +0 -638
- data/components/chaijs/chai/1.9.1/test/auth/.gitkeep +0 -0
- data/components/chaijs/chai/1.9.1/test/bootstrap/index.js +0 -22
- data/components/chaijs/chai/1.9.1/test/bootstrap/karma.js +0 -22
- data/components/chaijs/chai/1.9.1/test/configuration.js +0 -133
- data/components/chaijs/chai/1.9.1/test/display/errors.js +0 -14
- data/components/chaijs/chai/1.9.1/test/display/message.js +0 -47
- data/components/chaijs/chai/1.9.1/test/expect.js +0 -814
- data/components/chaijs/chai/1.9.1/test/globalShould.js +0 -15
- data/components/chaijs/chai/1.9.1/test/plugins.js +0 -24
- data/components/chaijs/chai/1.9.1/test/should.js +0 -744
- data/components/chaijs/chai/1.9.1/test/utilities.js +0 -309
- data/components/chaijs/deep-eql/0.1.3/component.json +0 -20
- data/components/chaijs/deep-eql/0.1.3/lib/eql.js +0 -257
- data/components/chaijs/type-detect/0.1.1/component.json +0 -18
- data/components/chaijs/type-detect/0.1.1/lib/type.js +0 -142
- data/components/component/classes/1.2.1/component.json +0 -19
- data/components/component/classes/1.2.1/index.js +0 -184
- data/components/component/domify/1.2.2/component.json +0 -22
- data/components/component/domify/1.2.2/index.js +0 -87
- data/components/component/event/0.1.3/component.json +0 -13
- data/components/component/event/0.1.3/index.js +0 -35
- data/components/component/jquery/1.9.1/component.json +0 -14
- data/components/component/jquery/1.9.1/index.js +0 -9601
- data/components/component/query/0.0.3/component.json +0 -23
- data/components/component/query/0.0.3/index.js +0 -21
- data/lib/tasks/.gitkeep +0 -0
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "type-detect",
|
|
3
|
-
"version": "0.1.1",
|
|
4
|
-
"description": "Improved typeof detection for node.js and the browser.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"keywords": [],
|
|
7
|
-
"main": "lib/type.js",
|
|
8
|
-
"scripts": [
|
|
9
|
-
"lib/type.js"
|
|
10
|
-
],
|
|
11
|
-
"dependencies": {},
|
|
12
|
-
"development": {
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"chaijs/simple-assert": "*"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"repository": "chaijs/type-detect"
|
|
18
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* type-detect
|
|
3
|
-
* Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
|
|
4
|
-
* MIT Licensed
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/*!
|
|
8
|
-
* Primary Exports
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
var exports = module.exports = getType;
|
|
12
|
-
|
|
13
|
-
/*!
|
|
14
|
-
* Detectable javascript natives
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
var natives = {
|
|
18
|
-
'[object Array]': 'array'
|
|
19
|
-
, '[object RegExp]': 'regexp'
|
|
20
|
-
, '[object Function]': 'function'
|
|
21
|
-
, '[object Arguments]': 'arguments'
|
|
22
|
-
, '[object Date]': 'date'
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* ### typeOf (obj)
|
|
27
|
-
*
|
|
28
|
-
* Use several different techniques to determine
|
|
29
|
-
* the type of object being tested.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @param {Mixed} object
|
|
33
|
-
* @return {String} object type
|
|
34
|
-
* @api public
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
function getType (obj) {
|
|
38
|
-
var str = Object.prototype.toString.call(obj);
|
|
39
|
-
if (natives[str]) return natives[str];
|
|
40
|
-
if (obj === null) return 'null';
|
|
41
|
-
if (obj === undefined) return 'undefined';
|
|
42
|
-
if (obj === Object(obj)) return 'object';
|
|
43
|
-
return typeof obj;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
exports.Library = Library;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* ### Library
|
|
50
|
-
*
|
|
51
|
-
* Create a repository for custom type detection.
|
|
52
|
-
*
|
|
53
|
-
* ```js
|
|
54
|
-
* var lib = new type.Library;
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
function Library () {
|
|
60
|
-
this.tests = {};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* #### .of (obj)
|
|
65
|
-
*
|
|
66
|
-
* Expose replacement `typeof` detection to the library.
|
|
67
|
-
*
|
|
68
|
-
* ```js
|
|
69
|
-
* if ('string' === lib.of('hello world')) {
|
|
70
|
-
* // ...
|
|
71
|
-
* }
|
|
72
|
-
* ```
|
|
73
|
-
*
|
|
74
|
-
* @param {Mixed} object to test
|
|
75
|
-
* @return {String} type
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
Library.prototype.of = getType;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* #### .define (type, test)
|
|
82
|
-
*
|
|
83
|
-
* Add a test to for the `.test()` assertion.
|
|
84
|
-
*
|
|
85
|
-
* Can be defined as a regular expression:
|
|
86
|
-
*
|
|
87
|
-
* ```js
|
|
88
|
-
* lib.define('int', /^[0-9]+$/);
|
|
89
|
-
* ```
|
|
90
|
-
*
|
|
91
|
-
* ... or as a function:
|
|
92
|
-
*
|
|
93
|
-
* ```js
|
|
94
|
-
* lib.define('bln', function (obj) {
|
|
95
|
-
* if ('boolean' === lib.of(obj)) return true;
|
|
96
|
-
* var blns = [ 'yes', 'no', 'true', 'false', 1, 0 ];
|
|
97
|
-
* if ('string' === lib.of(obj)) obj = obj.toLowerCase();
|
|
98
|
-
* return !! ~blns.indexOf(obj);
|
|
99
|
-
* });
|
|
100
|
-
* ```
|
|
101
|
-
*
|
|
102
|
-
* @param {String} type
|
|
103
|
-
* @param {RegExp|Function} test
|
|
104
|
-
* @api public
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
|
-
Library.prototype.define = function (type, test) {
|
|
108
|
-
if (arguments.length === 1) return this.tests[type];
|
|
109
|
-
this.tests[type] = test;
|
|
110
|
-
return this;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* #### .test (obj, test)
|
|
115
|
-
*
|
|
116
|
-
* Assert that an object is of type. Will first
|
|
117
|
-
* check natives, and if that does not pass it will
|
|
118
|
-
* use the user defined custom tests.
|
|
119
|
-
*
|
|
120
|
-
* ```js
|
|
121
|
-
* assert(lib.test('1', 'int'));
|
|
122
|
-
* assert(lib.test('yes', 'bln'));
|
|
123
|
-
* ```
|
|
124
|
-
*
|
|
125
|
-
* @param {Mixed} object
|
|
126
|
-
* @param {String} type
|
|
127
|
-
* @return {Boolean} result
|
|
128
|
-
* @api public
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
Library.prototype.test = function (obj, type) {
|
|
132
|
-
if (type === getType(obj)) return true;
|
|
133
|
-
var test = this.tests[type];
|
|
134
|
-
|
|
135
|
-
if (test && 'regexp' === getType(test)) {
|
|
136
|
-
return test.test(obj);
|
|
137
|
-
} else if (test && 'function' === getType(test)) {
|
|
138
|
-
return test(obj);
|
|
139
|
-
} else {
|
|
140
|
-
throw new ReferenceError('Type test "' + type + '" not defined or invalid.');
|
|
141
|
-
}
|
|
142
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "classes",
|
|
3
|
-
"version": "1.2.1",
|
|
4
|
-
"description": "Cross-browser element class list",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"dom",
|
|
7
|
-
"html",
|
|
8
|
-
"classList",
|
|
9
|
-
"class",
|
|
10
|
-
"ui"
|
|
11
|
-
],
|
|
12
|
-
"scripts": [
|
|
13
|
-
"index.js"
|
|
14
|
-
],
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"component/indexof": "*"
|
|
17
|
-
},
|
|
18
|
-
"repository": "component/classes"
|
|
19
|
-
}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Module dependencies.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
var index = require('indexof');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Whitespace regexp.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
var re = /\s+/;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* toString reference.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
var toString = Object.prototype.toString;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Wrap `el` in a `ClassList`.
|
|
21
|
-
*
|
|
22
|
-
* @param {Element} el
|
|
23
|
-
* @return {ClassList}
|
|
24
|
-
* @api public
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
module.exports = function(el){
|
|
28
|
-
return new ClassList(el);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Initialize a new ClassList for `el`.
|
|
33
|
-
*
|
|
34
|
-
* @param {Element} el
|
|
35
|
-
* @api private
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
function ClassList(el) {
|
|
39
|
-
if (!el) throw new Error('A DOM element reference is required');
|
|
40
|
-
this.el = el;
|
|
41
|
-
this.list = el.classList;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Add class `name` if not already present.
|
|
46
|
-
*
|
|
47
|
-
* @param {String} name
|
|
48
|
-
* @return {ClassList}
|
|
49
|
-
* @api public
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
ClassList.prototype.add = function(name){
|
|
53
|
-
// classList
|
|
54
|
-
if (this.list) {
|
|
55
|
-
this.list.add(name);
|
|
56
|
-
return this;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// fallback
|
|
60
|
-
var arr = this.array();
|
|
61
|
-
var i = index(arr, name);
|
|
62
|
-
if (!~i) arr.push(name);
|
|
63
|
-
this.el.className = arr.join(' ');
|
|
64
|
-
return this;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Remove class `name` when present, or
|
|
69
|
-
* pass a regular expression to remove
|
|
70
|
-
* any which match.
|
|
71
|
-
*
|
|
72
|
-
* @param {String|RegExp} name
|
|
73
|
-
* @return {ClassList}
|
|
74
|
-
* @api public
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
ClassList.prototype.remove = function(name){
|
|
78
|
-
if ('[object RegExp]' == toString.call(name)) {
|
|
79
|
-
return this.removeMatching(name);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// classList
|
|
83
|
-
if (this.list) {
|
|
84
|
-
this.list.remove(name);
|
|
85
|
-
return this;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// fallback
|
|
89
|
-
var arr = this.array();
|
|
90
|
-
var i = index(arr, name);
|
|
91
|
-
if (~i) arr.splice(i, 1);
|
|
92
|
-
this.el.className = arr.join(' ');
|
|
93
|
-
return this;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Remove all classes matching `re`.
|
|
98
|
-
*
|
|
99
|
-
* @param {RegExp} re
|
|
100
|
-
* @return {ClassList}
|
|
101
|
-
* @api private
|
|
102
|
-
*/
|
|
103
|
-
|
|
104
|
-
ClassList.prototype.removeMatching = function(re){
|
|
105
|
-
var arr = this.array();
|
|
106
|
-
for (var i = 0; i < arr.length; i++) {
|
|
107
|
-
if (re.test(arr[i])) {
|
|
108
|
-
this.remove(arr[i]);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return this;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Toggle class `name`, can force state via `force`.
|
|
116
|
-
*
|
|
117
|
-
* For browsers that support classList, but do not support `force` yet,
|
|
118
|
-
* the mistake will be detected and corrected.
|
|
119
|
-
*
|
|
120
|
-
* @param {String} name
|
|
121
|
-
* @param {Boolean} force
|
|
122
|
-
* @return {ClassList}
|
|
123
|
-
* @api public
|
|
124
|
-
*/
|
|
125
|
-
|
|
126
|
-
ClassList.prototype.toggle = function(name, force){
|
|
127
|
-
// classList
|
|
128
|
-
if (this.list) {
|
|
129
|
-
if ("undefined" !== typeof force) {
|
|
130
|
-
if (force !== this.list.toggle(name, force)) {
|
|
131
|
-
this.list.toggle(name); // toggle again to correct
|
|
132
|
-
}
|
|
133
|
-
} else {
|
|
134
|
-
this.list.toggle(name);
|
|
135
|
-
}
|
|
136
|
-
return this;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// fallback
|
|
140
|
-
if ("undefined" !== typeof force) {
|
|
141
|
-
if (!force) {
|
|
142
|
-
this.remove(name);
|
|
143
|
-
} else {
|
|
144
|
-
this.add(name);
|
|
145
|
-
}
|
|
146
|
-
} else {
|
|
147
|
-
if (this.has(name)) {
|
|
148
|
-
this.remove(name);
|
|
149
|
-
} else {
|
|
150
|
-
this.add(name);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return this;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Return an array of classes.
|
|
159
|
-
*
|
|
160
|
-
* @return {Array}
|
|
161
|
-
* @api public
|
|
162
|
-
*/
|
|
163
|
-
|
|
164
|
-
ClassList.prototype.array = function(){
|
|
165
|
-
var str = this.el.className.replace(/^\s+|\s+$/g, '');
|
|
166
|
-
var arr = str.split(re);
|
|
167
|
-
if ('' === arr[0]) arr.shift();
|
|
168
|
-
return arr;
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Check if class `name` is present.
|
|
173
|
-
*
|
|
174
|
-
* @param {String} name
|
|
175
|
-
* @return {ClassList}
|
|
176
|
-
* @api public
|
|
177
|
-
*/
|
|
178
|
-
|
|
179
|
-
ClassList.prototype.has =
|
|
180
|
-
ClassList.prototype.contains = function(name){
|
|
181
|
-
return this.list
|
|
182
|
-
? this.list.contains(name)
|
|
183
|
-
: !! ~index(this.array(), name);
|
|
184
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "domify",
|
|
3
|
-
"version": "1.2.2",
|
|
4
|
-
"description": "turn HTML into DOM elements",
|
|
5
|
-
"development": {
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"component/assert": "*"
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
"keywords": [
|
|
11
|
-
"dom",
|
|
12
|
-
"html",
|
|
13
|
-
"client",
|
|
14
|
-
"browser",
|
|
15
|
-
"component"
|
|
16
|
-
],
|
|
17
|
-
"scripts": [
|
|
18
|
-
"index.js"
|
|
19
|
-
],
|
|
20
|
-
"license": "MIT",
|
|
21
|
-
"repository": "component/domify"
|
|
22
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Expose `parse`.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
module.exports = parse;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Wrap map from jquery.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
var map = {
|
|
13
|
-
legend: [1, '<fieldset>', '</fieldset>'],
|
|
14
|
-
tr: [2, '<table><tbody>', '</tbody></table>'],
|
|
15
|
-
col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
|
|
16
|
-
_default: [0, '', '']
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
map.td =
|
|
20
|
-
map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
|
|
21
|
-
|
|
22
|
-
map.option =
|
|
23
|
-
map.optgroup = [1, '<select multiple="multiple">', '</select>'];
|
|
24
|
-
|
|
25
|
-
map.thead =
|
|
26
|
-
map.tbody =
|
|
27
|
-
map.colgroup =
|
|
28
|
-
map.caption =
|
|
29
|
-
map.tfoot = [1, '<table>', '</table>'];
|
|
30
|
-
|
|
31
|
-
map.text =
|
|
32
|
-
map.circle =
|
|
33
|
-
map.ellipse =
|
|
34
|
-
map.line =
|
|
35
|
-
map.path =
|
|
36
|
-
map.polygon =
|
|
37
|
-
map.polyline =
|
|
38
|
-
map.rect = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Parse `html` and return the children.
|
|
42
|
-
*
|
|
43
|
-
* @param {String} html
|
|
44
|
-
* @return {Array}
|
|
45
|
-
* @api private
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
function parse(html) {
|
|
49
|
-
if ('string' != typeof html) throw new TypeError('String expected');
|
|
50
|
-
|
|
51
|
-
// tag name
|
|
52
|
-
var m = /<([\w:]+)/.exec(html);
|
|
53
|
-
if (!m) return document.createTextNode(html);
|
|
54
|
-
|
|
55
|
-
html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace
|
|
56
|
-
|
|
57
|
-
var tag = m[1];
|
|
58
|
-
|
|
59
|
-
// body support
|
|
60
|
-
if (tag == 'body') {
|
|
61
|
-
var el = document.createElement('html');
|
|
62
|
-
el.innerHTML = html;
|
|
63
|
-
return el.removeChild(el.lastChild);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// wrap map
|
|
67
|
-
var wrap = map[tag] || map._default;
|
|
68
|
-
var depth = wrap[0];
|
|
69
|
-
var prefix = wrap[1];
|
|
70
|
-
var suffix = wrap[2];
|
|
71
|
-
var el = document.createElement('div');
|
|
72
|
-
el.innerHTML = prefix + html + suffix;
|
|
73
|
-
while (depth--) el = el.lastChild;
|
|
74
|
-
|
|
75
|
-
// one element
|
|
76
|
-
if (el.firstChild == el.lastChild) {
|
|
77
|
-
return el.removeChild(el.firstChild);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// several elements
|
|
81
|
-
var fragment = document.createDocumentFragment();
|
|
82
|
-
while (el.firstChild) {
|
|
83
|
-
fragment.appendChild(el.removeChild(el.firstChild));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return fragment;
|
|
87
|
-
}
|