Skip to content

Commit 660d101

Browse files
2.2.0
1 parent bb137a6 commit 660d101

9 files changed

Lines changed: 790 additions & 702 deletions

File tree

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "riot",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "A React- like, 3.5K user interface library",
55
"homepage": "https://muut.com/riotjs/",
66
"repository": { "type": "git", "url": "git://github.com/riot/riot.git" },

compiler.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ riot.parsers = {
1414
}
1515
}
1616
}
17+
// 4 the nostalgics
18+
riot.parsers.js.coffeescript = riot.parsers.js.coffee
1719

1820

1921
var BOOL_ATTR = ('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,'+
@@ -44,7 +46,8 @@ var BOOL_ATTR = ('allowfullscreen,async,autofocus,autoplay,checked,compact,contr
4446
HTML_COMMENT = /<!--.*?-->/g,
4547
CLOSED_TAG = /<([\w\-]+)([^>]*)\/\s*>/g,
4648
LINE_COMMENT = /^\s*\/\/.*$/gm,
47-
JS_COMMENT = /\/\*[^\x00]*?\*\//gm
49+
JS_COMMENT = /\/\*[^\x00]*?\*\//gm,
50+
INPUT_NUMBER = /(<input\s[^>]*?)type=['"]number['"]/gm
4851

4952
function mktag(name, html, css, attrs, js) {
5053
return 'riot.tag(\''
@@ -68,6 +71,9 @@ function compileHTML(html, opts, type) {
6871
// strip comments
6972
html = html.trim().replace(HTML_COMMENT, '')
7073

74+
// input type=numbr
75+
html = html.replace(INPUT_NUMBER, '$1riot-type='+brackets(0)+'"number"'+brackets(1)) // fake expression
76+
7177
// alter special attribute names
7278
html = html.replace(SET_ATTR, function(full, name, _, expr) {
7379
if (expr.indexOf(brackets(0)) >= 0) {
@@ -131,7 +137,7 @@ function riotjs(js) {
131137
var end = /[{}]/.exec(l.slice(-1)),
132138
m = end && /(\s+)([\w]+)\s*\(([\w,\s]*)\)\s*\{/.exec(line)
133139

134-
if (m && !/^(if|while|switch|for)$/.test(m[2])) {
140+
if (m && !/^(if|while|switch|for|catch)$/.test(m[2])) {
135141
lines[i] = m[1] + 'this.' + m[2] + ' = function(' + m[3] + ') {'
136142

137143
// foo() { }
@@ -160,8 +166,9 @@ function riotjs(js) {
160166
function scopedCSS (tag, style, type) {
161167
return style.replace(CSS_COMMENT, '').replace(CSS_SELECTOR, function (m, p1, p2) {
162168
return p1 + ' ' + p2.split(/\s*,\s*/g).map(function(sel) {
163-
var s = sel.replace(/:scope\s*/, '')
164-
return sel[0] == '@' ? sel : tag + ' ' + s +', [riot-tag="'+tag+'"] ' + s
169+
var s = sel.trim().replace(/:scope\s*/, '')
170+
return s[0] == '@' || s == 'from' || s == 'to' || /%$/.test(s) ? s :
171+
tag + ' ' + s + ', [riot-tag="' + tag + '"] ' + s
165172
}).join(',')
166173
}).trim()
167174
}
@@ -216,7 +223,7 @@ function compile(src, opts) {
216223
style = ''
217224

218225
html = html.replace(STYLE, function(_, fullType, _type, _style) {
219-
if (fullType && 'scoped' == fullType.trim()) styleType = 'scoped-css'
226+
if (fullType && fullType.trim() == 'scoped') styleType = 'scoped-css'
220227
else if (_type) styleType = _type.replace('text/', '')
221228
style = _style
222229
return ''
@@ -273,7 +280,7 @@ function compileScripts(fn) {
273280
fn && fn()
274281
}
275282

276-
if(!scriptsAmount) {
283+
if (!scriptsAmount) {
277284
done()
278285
} else {
279286
;[].map.call(scripts, function(script) {

compiler.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "riot",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "A React- like, 3.5K user interface library",
55
"repository": "muut/riotjs",
66
"license": "MIT",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "riot",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "A React- like, 3.5K user interface library",
55
"homepage": "https://muut.com/riotjs/",
66
"repository": "muut/riotjs",

0 commit comments

Comments
 (0)