Changeset 35675
- Timestamp:
- 11/18/2015 07:14:50 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/comment-reply.js
r35593 r35675 1 1 var addComment = { 2 2 moveForm: function( commId, parentId, respondId, postId ) { 3 var div, element, node,style, cssHidden,3 var div, element, style, cssHidden, 4 4 t = this, 5 5 comm = t.I( commId ), … … 48 48 }; 49 49 50 // Set initial focus to the first form focusable element. 50 /* 51 * Set initial focus to the first form focusable element. 52 * Try/catch used just to avoid errors in IE 7- which return visibility 53 * 'inherit' when the visibility value is inherited from an ancestor. 54 */ 51 55 try { 52 56 for ( var i = 0; i < commentForm.elements.length; i++ ) { 53 57 element = commentForm.elements[i]; 58 cssHidden = false; 59 60 // Modern browsers. 61 if ( 'getComputedStyle' in window ) { 62 style = window.getComputedStyle( element ); 63 // IE 8. 64 } else if ( document.documentElement.currentStyle ) { 65 style = element.currentStyle; 66 } 67 68 /* 69 * For display none, do the same thing jQuery does. For visibility, 70 * check the element computed style since browsers are already doing 71 * the job for us. In fact, the visibility computed style is the actual 72 * computed value and already takes into account the element ancestors. 73 */ 74 if ( ( element.offsetWidth <= 0 && element.offsetHeight <= 0 ) || style.visibility === 'hidden' ) { 75 cssHidden = true; 76 } 54 77 55 78 // Skip form elements that are hidden or disabled. 56 if ( 'hidden' === element.type || element. hasAttribute( 'disabled' )) {79 if ( 'hidden' === element.type || element.disabled || cssHidden ) { 57 80 continue; 58 }59 60 if ( 'getComputedStyle' in window ) {61 node = element;62 cssHidden = false;63 64 while( node.parentNode ) {65 style = window.getComputedStyle( node );66 67 if ( style.display === 'none' || style.visibility === 'hidden' ) {68 cssHidden = true;69 break;70 }71 72 node = node.parentNode;73 }74 75 if ( cssHidden ) {76 continue;77 }78 81 } 79 82 … … 82 85 break; 83 86 } 87 84 88 } catch( er ) {} 85 89
Note: See TracChangeset
for help on using the changeset viewer.