support ms and s unit

This commit is contained in:
yuanchuan 2017-02-26 16:46:30 +08:00
parent 7d75cb1e09
commit 6c305e1523
2 changed files with 2 additions and 2 deletions

View File

@ -114,7 +114,7 @@ function add_unit(fn, unit) {
function get_unit(str) {
if (!str) return '';
let unit = /(%|cm|em|ex|in|mm|pc|pt|px|vh|vw|vmin|deg)$/;
let unit = /(%|cm|em|ex|in|mm|pc|pt|px|vh|vw|vmin|deg|ms|s)$/;
let matched = ''.trim.call(str).match(unit);
return matched ? matched[0] : '';
}

View File

@ -74,7 +74,7 @@ function add_unit(fn, unit) {
function get_unit(str) {
if (!str) return '';
let unit = /(%|cm|em|ex|in|mm|pc|pt|px|vh|vw|vmin|deg)$/;
let unit = /(%|cm|em|ex|in|mm|pc|pt|px|vh|vw|vmin|deg|ms|s)$/;
let matched = ''.trim.call(str).match(unit);
return matched ? matched[0] : '';
}