mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ef10672364
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92488 467b73ca-7a2a-4603-9d3b-597d59a354a9
24 lines
823 B
JavaScript
24 lines
823 B
JavaScript
// apply inline-box only for mozilla
|
|
if( jQuery.browser.mozilla ) {
|
|
// do when DOM is ready
|
|
$( function() {
|
|
// search form, hide it, search labels to modify, filter classes nocmx and error
|
|
$( 'form.cmxform' ).hide().find( 'p>label:not(.nocmx):not(.error)' ).each( function() {
|
|
var $this = $(this);
|
|
var labelContent = $this.html();
|
|
var labelWidth = document.defaultView.getComputedStyle( this, '' ).getPropertyValue( 'width' );
|
|
// create block element with width of label
|
|
var labelSpan = $("<span>")
|
|
.css("display", "block")
|
|
.width(labelWidth)
|
|
.html(labelContent);
|
|
// change display to mozilla specific inline-box
|
|
$this.css("display", "-moz-inline-box")
|
|
// remove children
|
|
.empty()
|
|
// add span element
|
|
.append(labelSpan);
|
|
// show form again
|
|
}).end().show();
|
|
});
|
|
}; |