Bundled output for commit c9629ffcbc [skip ci]
This commit is contained in:
parent
c9629ffcbc
commit
19969e2555
3 changed files with 59 additions and 45 deletions
13
mithril.js
13
mithril.js
|
|
@ -17,6 +17,10 @@ Vnode.normalizeChildren = function normalizeChildren(children) {
|
|||
var selectorParser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g
|
||||
var selectorCache = {}
|
||||
var hasOwn = {}.hasOwnProperty
|
||||
function isEmpty(object) {
|
||||
for (var key in object) if (hasOwn.call(object, key)) return false
|
||||
return true
|
||||
}
|
||||
function compileSelector(selector) {
|
||||
var match, tag = "div", classes = [], attrs = {}
|
||||
while (match = selectorParser.exec(selector)) {
|
||||
|
|
@ -37,6 +41,15 @@ function compileSelector(selector) {
|
|||
function execSelector(state, attrs, children) {
|
||||
var hasAttrs = false, childList, text
|
||||
var className = attrs.className || attrs.class
|
||||
if (!isEmpty(state.attrs) && !isEmpty(attrs)) {
|
||||
var newAttrs = {}
|
||||
for(var key in attrs) {
|
||||
if (hasOwn.call(attrs, key)) {
|
||||
newAttrs[key] = attrs[key]
|
||||
}
|
||||
}
|
||||
attrs = newAttrs
|
||||
}
|
||||
for (var key in state.attrs) {
|
||||
if (hasOwn.call(state.attrs, key)) {
|
||||
attrs[key] = state.attrs[key]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue