Палсеич— (lusever) wrote in changelog,
Палсеич—
lusever
changelog

[js] r285: LJSUP-5694: CLIENTSIDE dom.js refactorin...

Committer: pkornilov
LJSUP-5694: CLIENTSIDE dom.js refactoring.
U   trunk/dom.js
Modified: trunk/dom.js
===================================================================
--- trunk/dom.js	2010-03-29 02:54:02 UTC (rev 284)
+++ trunk/dom.js	2010-04-01 02:35:19 UTC (rev 285)
@@ -66,22 +66,16 @@
 
     /* style */
 
-	/* used:
-		htdocs/stc/js/betanav.js:12:
-		htdocs/stc/js/horizon.js:13:
-	*/
-    getComputedStyle: function( e ) {
-        if( e.currentStyle )
-            return e.currentStyle;
-        var style = {};
-        var owner = DOM.getOwnerDocument( e );
-        if( owner && owner.defaultView && owner.defaultView.getComputedStyle ) {            
-            try {
-                style = owner.defaultView.getComputedStyle( e, null );
-            } catch( e ) {}
-        }
-        return style;
-    },
+	getComputedStyle: function(node)
+	{
+		if (node.currentStyle) {
+			return node.currentStyle;
+		}
+		var defaultView = node.ownerDocument.defaultView;
+		if (defaultView && defaultView.getComputedStyle) {
+			return defaultView.getComputedStyle(node, null);
+		}
+	},
 
 
     // given a window (or defaulting to current window), returns
@@ -155,7 +149,7 @@
             try { // IE 6 sometimes gives an unwarranted error ("htmlfile: Unspecified error").
                 e = e.offsetParent;
             } catch ( err ) {
-                log( "In DOM.getAbsoluteDimensions: " + err.message ); 
+                log( "In DOM.getAbsoluteDimensions: " + err.message );
                 if ( ++bork > 25 )
                     return null;
             }
@@ -226,17 +220,7 @@
 
     /* dom methods */
 
-    getOwnerDocument: function( n ) {
-        if( !n )
-            return document;
-        if( n.ownerDocument )
-            return n.ownerDocument;
-        if( n.getElementById )
-            return n;
-        return document;
-    },
 
-
     filterElementsByClassName: function( es, className ) {
         var filtered = [];
         for( var i = 0; i < es.length; i++ ) {
@@ -278,21 +262,13 @@
         return filtered;
     },
 
-
+	// private
     getElementsByTagAndAttribute: function( root, tagName, attr ) {
         if( !root )
             root = document;
         var es = root.getElementsByTagName( tagName );
         return DOM.filterElementsByAttribute( es, attr );
     },
-    
-    // used in
-		//htdocs/js/ljadsense.js:651
-		//htdocs/js/adsense.js:615
-		//htdocs/manage/notes.bml:179
-    getElementsByAttribute: function( root, attr ) {
-        return DOM.getElementsByTagAndAttribute( root, "*", attr );
-    },
 
 
     getElementsByAttributeAndValue: function( root, attr, value ) {
@@ -329,13 +305,6 @@
         }
         return as;
     },
-    
-    
-    // used only htdocs/stc/js/esn.js:55
-    getFirstAncestorByTagName: function( n, tagName, includeSelf ) {
-        var es = DOM.getAncestors( n, includeSelf );
-		return DOM.filterElementsByTagName( es, tagName )[0];
-    },
 
 
     getAncestorsByClassName: function( n, className, includeSelf ) {
@@ -448,7 +417,7 @@
 	setSelectedRange: function(node, start, end)
 	{
 		// see https://bugzilla.mozilla.org/show_bug.cgi?id=265159
-		node.focus(); 
+		node.focus();
 		if (node.setSelectionRange)
 		{
 			node.setSelectionRange(start, end);

Tags: js, lusever
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments