| 1 |
// apply inline-box only for mozilla |
| 2 |
if( jQuery.browser.mozilla ) { |
| 3 |
// do when DOM is ready |
| 4 |
$( function() { |
| 5 |
// search form, hide it, search labels to modify, filter classes nocmx and error |
| 6 |
$( 'form.cmxform' ).hide().find( 'p>label:not(.nocmx):not(.error)' ).each( function() { |
| 7 |
var $this = $(this); |
| 8 |
var labelContent = $this.html(); |
| 9 |
var labelWidth = document.defaultView.getComputedStyle( this, '' ).getPropertyValue( 'width' ); |
| 10 |
// create block element with width of label |
| 11 |
var labelSpan = $("<span>") |
| 12 |
.css("display", "block") |
| 13 |
.width(labelWidth) |
| 14 |
.html(labelContent); |
| 15 |
// change display to mozilla specific inline-box |
| 16 |
$this.css("display", "-moz-inline-box") |
| 17 |
// remove children |
| 18 |
.empty() |
| 19 |
// add span element |
| 20 |
.append(labelSpan); |
| 21 |
// show form again |
| 22 |
}).end().show(); |
| 23 |
}); |
| 24 |
}; |