Browse Source

Node cleanup.

Nicolas Cannasse 19 years ago
parent
commit
75bcf7abfc
6 changed files with 11 additions and 16 deletions
  1. 2 2
      std/Node.hx
  2. 3 3
      std/XmlParser.hx
  3. 0 2
      std/flash/Boot.hx
  4. 1 4
      std/js/Boot.hx
  5. 4 4
      std/neko/NekoNode__.hx
  6. 1 1
      std/tools/haxedoc/Main.hx

+ 2 - 2
std/Node.hx

@@ -25,8 +25,8 @@
 
 extern class Node {
 
-	static var element_node : Int = 1;
-	static var text_node : Int = 3;
+	static var ELEMENT_NODE : Int = 1;
+	static var TEXT_NODE : Int = 3;
 
 	var nodeName : String;
 	var nodeValue : String;

+ 3 - 3
std/XmlParser.hx

@@ -54,7 +54,7 @@ class XmlParser {
 				cur : x,
 				xml : function(name,att) {
 					var x = new Node();
-					x.nodeType = Node.element_node;
+					x.nodeType = Node.ELEMENT_NODE;
 					x.nodeName = new String(name);
 					x.childNodes = new Array<Node>();
 					x.parentNode = untyped this.cur;
@@ -73,14 +73,14 @@ class XmlParser {
 				},
 				cdata : function(text) {
 					var x = new Node();
-					x.nodeType = Node.text_node;
+					x.nodeType = Node.TEXT_NODE;
 					x.nodeValue = new String(text);
 					x.parentNode = untyped this.cur;
 					untyped this.cur.childNodes.push(x);
 				},
 				pcdata : function(text) {
 					var x = new Node();
-					x.nodeType = Node.text_node;
+					x.nodeType = Node.TEXT_NODE;
 					x.nodeValue = new String(text);
 					x.parentNode = untyped this.cur;
 					untyped this.cur.childNodes.push(x);

+ 0 - 2
std/flash/Boot.hx

@@ -167,8 +167,6 @@ class Boot {
 			flash.system.Security = System.security;
 			flash.system.IME = System["IME"];
 			Node = _global["XMLNode"];
-			Node.element_node = 1;
-			Node.text_node = 3;
 			Node.prototype.removeChild = Node.prototype.removeNode;
 			Node.prototype.replaceChild = function(cnew,cold) {
 				this.insertBefore(cnew,cold);

+ 1 - 4
std/js/Boot.hx

@@ -180,10 +180,7 @@ class Boot {
 	private static function __init() {
 		untyped {
 			Lib.isIE = (document.all != null);
-			if( Lib.isIE )
-				Node = __js__("Object");
-			Node.element_node = 1;
-			Node.text_node = 3;
+			if( !Lib.isIE )
 			Node.prototype.nodes = function() {
 				return untyped {
 					p : 0,

+ 4 - 4
std/neko/NekoNode__.hx

@@ -27,8 +27,8 @@ package neko;
 
 class NekoNode__ implements Node {
 
-	public static var element_node : Int = 1;
-	public static var text_node : Int = 3;
+	public static var ELEMENT_NODE : Int = 1;
+	public static var TEXT_NODE : Int = 3;
 
 	public var nodeName : String;
 	public var nodeValue : String;
@@ -67,7 +67,7 @@ class NekoNode__ implements Node {
 	}
 
 	public function toString() {
-		if( nodeType == text_node )
+		if( nodeType == TEXT_NODE )
 			return nodeValue;
 		var s = new StringBuf();
 		if( nodeName != null ) {
@@ -110,7 +110,7 @@ class NekoNode__ implements Node {
 					if( x == null )
 						return null;
 					this.p++;
-					if( x.nodeType == 1 )
+					if( x.nodeType == ELEMENT_NODE )
 						return x;
 				}
 				return null;

+ 1 - 1
std/tools/haxedoc/Main.hx

@@ -464,7 +464,7 @@ class DocView {
 	}
 
 	static function displayHtml(html : Node) {
-		if( html.nodeType != Node.element_node ) {
+		if( html.nodeType != Node.ELEMENT_NODE ) {
 			print(html.toString());
 			return;
 		}