fix disappearing link text
This commit is contained in:
parent
9dcffab2ac
commit
d684b0fceb
7 changed files with 17 additions and 9 deletions
|
|
@ -126,6 +126,7 @@ new function(window) {
|
|||
var dataAttr = dataAttrs[attrName]
|
||||
var cachedAttr = cachedAttrs[attrName]
|
||||
if (!(attrName in cachedAttrs) || (cachedAttr !== dataAttr) || node === window.document.activeElement) {
|
||||
cachedAttrs[attrName] = dataAttr
|
||||
if (attrName === "config") continue
|
||||
else if (typeof dataAttr == "function" && attrName.indexOf("on") == 0) {
|
||||
if (String(dataAttr) !== String(cachedAttr)) node[attrName] = autoredraw(dataAttr, node)
|
||||
|
|
@ -137,7 +138,6 @@ new function(window) {
|
|||
}
|
||||
else if (attrName in node) node[attrName] = dataAttr
|
||||
else node.setAttribute(attrName, dataAttr)
|
||||
cachedAttrs[attrName] = dataAttr
|
||||
}
|
||||
}
|
||||
return cachedAttrs
|
||||
|
|
@ -673,6 +673,12 @@ function testMithril(mock) {
|
|||
m.render(root, m("ul", [{subtree: "retain"}]))
|
||||
return root.childNodes[0].childNodes[0].childNodes[0].nodeName === "A"
|
||||
})
|
||||
test(function() {
|
||||
var root = mock.document.createElement("div")
|
||||
m.render(root, m("a", {config: m.route}, "test"))
|
||||
m.render(root, m("a", {config: m.route}, "test"))
|
||||
return root.childNodes[0].childNodes[0].nodeValue === "test"
|
||||
})
|
||||
|
||||
//m.redraw
|
||||
test(function() {
|
||||
|
|
@ -796,14 +802,12 @@ function testMithril(mock) {
|
|||
var prop = m.request({method: "POST", url: "http://domain.com:80", data: {}}).then(function(value) {return value})
|
||||
var e = mock.XMLHttpRequest.$events.pop()
|
||||
e.target.onload(e)
|
||||
console.log(prop().url)
|
||||
return prop().url === "http://domain.com:80"
|
||||
})
|
||||
test(function() {
|
||||
var prop = m.request({method: "POST", url: "http://domain.com:80/:test1", data: {test1: "foo"}}).then(function(value) {return value})
|
||||
var e = mock.XMLHttpRequest.$events.pop()
|
||||
e.target.onload(e)
|
||||
console.log(prop().url)
|
||||
return prop().url === "http://domain.com:80/foo"
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ new function(window) {
|
|||
var dataAttr = dataAttrs[attrName]
|
||||
var cachedAttr = cachedAttrs[attrName]
|
||||
if (!(attrName in cachedAttrs) || (cachedAttr !== dataAttr) || node === window.document.activeElement) {
|
||||
cachedAttrs[attrName] = dataAttr
|
||||
if (attrName === "config") continue
|
||||
else if (typeof dataAttr == "function" && attrName.indexOf("on") == 0) {
|
||||
if (String(dataAttr) !== String(cachedAttr)) node[attrName] = autoredraw(dataAttr, node)
|
||||
|
|
@ -137,7 +138,6 @@ new function(window) {
|
|||
}
|
||||
else if (attrName in node) node[attrName] = dataAttr
|
||||
else node.setAttribute(attrName, dataAttr)
|
||||
cachedAttrs[attrName] = dataAttr
|
||||
}
|
||||
}
|
||||
return cachedAttrs
|
||||
|
|
|
|||
2
archive/v0.1.4/mithril.min.js
vendored
2
archive/v0.1.4/mithril.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -126,6 +126,7 @@ new function(window) {
|
|||
var dataAttr = dataAttrs[attrName]
|
||||
var cachedAttr = cachedAttrs[attrName]
|
||||
if (!(attrName in cachedAttrs) || (cachedAttr !== dataAttr) || node === window.document.activeElement) {
|
||||
cachedAttrs[attrName] = dataAttr
|
||||
if (attrName === "config") continue
|
||||
else if (typeof dataAttr == "function" && attrName.indexOf("on") == 0) {
|
||||
if (String(dataAttr) !== String(cachedAttr)) node[attrName] = autoredraw(dataAttr, node)
|
||||
|
|
@ -137,7 +138,6 @@ new function(window) {
|
|||
}
|
||||
else if (attrName in node) node[attrName] = dataAttr
|
||||
else node.setAttribute(attrName, dataAttr)
|
||||
cachedAttrs[attrName] = dataAttr
|
||||
}
|
||||
}
|
||||
return cachedAttrs
|
||||
|
|
|
|||
|
|
@ -141,6 +141,12 @@ function testMithril(mock) {
|
|||
m.render(root, m("ul", [{subtree: "retain"}]))
|
||||
return root.childNodes[0].childNodes[0].childNodes[0].nodeName === "A"
|
||||
})
|
||||
test(function() {
|
||||
var root = mock.document.createElement("div")
|
||||
m.render(root, m("a", {config: m.route}, "test"))
|
||||
m.render(root, m("a", {config: m.route}, "test"))
|
||||
return root.childNodes[0].childNodes[0].nodeValue === "test"
|
||||
})
|
||||
|
||||
//m.redraw
|
||||
test(function() {
|
||||
|
|
@ -264,14 +270,12 @@ function testMithril(mock) {
|
|||
var prop = m.request({method: "POST", url: "http://domain.com:80", data: {}}).then(function(value) {return value})
|
||||
var e = mock.XMLHttpRequest.$events.pop()
|
||||
e.target.onload(e)
|
||||
console.log(prop().url)
|
||||
return prop().url === "http://domain.com:80"
|
||||
})
|
||||
test(function() {
|
||||
var prop = m.request({method: "POST", url: "http://domain.com:80/:test1", data: {test1: "foo"}}).then(function(value) {return value})
|
||||
var e = mock.XMLHttpRequest.$events.pop()
|
||||
e.target.onload(e)
|
||||
console.log(prop().url)
|
||||
return prop().url === "http://domain.com:80/foo"
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue