Skip to content

Commit 3d3d7ce

Browse files
Holly LiuHolly Liu
authored andcommitted
fix element.node bug
1 parent 485d983 commit 3d3d7ce

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

lib/utils.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,12 @@ var Utils = {
272272
// fix raphael #491
273273
if (Raphael.svg && element.node && element.node.nodeName == "text" && element.node.childNodes.length > 0) {
274274
setTimeout(function () {
275-
var nodeY = element.node.getAttribute("y");
276-
var childDy = element.node.childNodes[0].getAttribute("dy");
277-
if (nodeY == childDy) {
278-
element.node.childNodes[0].setAttribute("dy", 0);
275+
if (element.node) {
276+
var nodeY = element.node.getAttribute("y");
277+
var childDy = element.node.childNodes[0].getAttribute("dy");
278+
if (nodeY == childDy) {
279+
element.node.childNodes[0].setAttribute("dy", 0);
280+
}
279281
}
280282
});
281283
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-raphael",
3-
"version": "0.8.0-rc6",
3+
"version": "0.8.0-rc7",
44
"description": "reactify raphael",
55
"main": "./lib",
66
"scripts": {

src/utils.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,13 @@ var Utils = {
193193
// fix raphael #491
194194
if(Raphael.svg && element.node && element.node.nodeName=="text" && element.node.childNodes.length>0){
195195
setTimeout(function(){
196-
var nodeY = element.node.getAttribute("y");
197-
var childDy = element.node.childNodes[0].getAttribute("dy");
198-
if(nodeY == childDy){
199-
element.node.childNodes[0].setAttribute("dy",0);
200-
}
196+
if(element.node){
197+
var nodeY = element.node.getAttribute("y");
198+
var childDy = element.node.childNodes[0].getAttribute("dy");
199+
if(nodeY == childDy){
200+
element.node.childNodes[0].setAttribute("dy",0);
201+
}
202+
}
201203
})
202204
}
203205
}

0 commit comments

Comments
 (0)