tagsjs-rails 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/app/assets/javascripts/tagsjs/core.js +18 -8
- data/lib/tagsjs/rails/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2ec661f403ea9cbb09d44ee4c4c77a5ddc034e39
|
4
|
+
data.tar.gz: 57f8ab3b8cf9d2056cbc93f55845f228eb4bb352
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ca5f91657789869f03d9a0d927eacb88081e6ce3338701a4aefcea6dd2e60d454ba50cc114e53bf85f1f1ff3eddd7eb61030a692d5c274cf97136d37bde0878
|
7
|
+
data.tar.gz: 16d556e1aba065100aaa848b1f4e5680eed0f424e04715b0671cd3fee0b2f6bffc18ff77ce047f04a22668da3045c1030a60a6648a64e8b4f2ba0048f5489bd8
|
data/README.md
CHANGED
@@ -14,16 +14,14 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
|
|
14
14
|
}
|
15
15
|
})(function () {
|
16
16
|
var jstags = {
|
17
|
-
_createElement: function _createElement(tag, attributes, content) {
|
18
|
-
if (typeof attributes === 'string') {
|
19
|
-
content = attributes;
|
20
|
-
}
|
21
|
-
|
17
|
+
_createElement: function _createElement(tag, attributes, content, events) {
|
22
18
|
var element = document.createElement(tag);
|
23
19
|
|
20
|
+
this._setElementAttributes(attributes, element);
|
21
|
+
|
24
22
|
this._setElementContents(content, element);
|
25
23
|
|
26
|
-
this.
|
24
|
+
this._setElementEvents(events, element);
|
27
25
|
|
28
26
|
return element;
|
29
27
|
},
|
@@ -64,12 +62,24 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
|
|
64
62
|
element.appendChild(content);
|
65
63
|
}
|
66
64
|
}
|
65
|
+
},
|
66
|
+
_setElementEvents: function _setElementEvents(events, element) {
|
67
|
+
if (!events) return;
|
68
|
+
Object.keys(events).forEach(function (name) {
|
69
|
+
element.addEventListener(name, events[name]);
|
70
|
+
});
|
67
71
|
}
|
68
72
|
};
|
69
73
|
var AVAILABLE_TAGS = ['a', 'abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'b', 'base', 'basefont', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'meta', 'meter', 'nav', 'noframes', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'svg', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr'];
|
70
74
|
AVAILABLE_TAGS.forEach(function (tag) {
|
71
|
-
jstags[tag] = function (attributes, content) {
|
72
|
-
|
75
|
+
jstags[tag] = function (attributes, content, events) {
|
76
|
+
if (typeof content === 'undefined') {
|
77
|
+
// when calling with a single argument
|
78
|
+
content = attributes;
|
79
|
+
attributes = undefined;
|
80
|
+
}
|
81
|
+
|
82
|
+
return this._createElement(tag, attributes, content, events);
|
73
83
|
};
|
74
84
|
});
|
75
85
|
return jstags;
|
data/lib/tagsjs/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tagsjs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Federico Ramirez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -59,7 +59,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0'
|
61
61
|
requirements: []
|
62
|
-
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 2.5.2.3
|
63
64
|
signing_key:
|
64
65
|
specification_version: 4
|
65
66
|
summary: Human-friendly API for building DOM elements in JavaScript.
|