提交 8fa28bf7 编写于 作者: M mindless

Make prepareDD and hasClassName more robust to handle case

where a TextNode (like whitespace) is the firstChild of a node.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@28301 71c3de6d-444a-0410-be80-ed276b4c234a
上级 1d0c8d5e
......@@ -381,7 +381,7 @@ var hudsonRules = {
var h = e;
// locate a handle
while(!Element.hasClassName(h,"dd-handle"))
h = h.firstChild;
h = h.firstChild ? h.firstChild : h.nextSibling;
dd.setHandleElId(h);
}
var withDragDrop = Element.hasClassName(e,"with-drag-drop");
......
......@@ -1534,7 +1534,7 @@ Element.Methods = {
hasClassName: function(element, className) {
if (!(element = $(element))) return;
var elementClassName = element.className;
if (elementClassName.length == 0) return false;
if (!elementClassName || elementClassName.length == 0) return false;
if (elementClassName == className ||
elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
return true;
......@@ -3315,4 +3315,4 @@ if (Prototype.Browser.WebKit) {
}
}
Element.addMethods();
\ No newline at end of file
Element.addMethods();
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册