On Feb 10, 2007, at 7:42 PM, Glen Lipka wrote:
http://www.barackobama.com (jQuery!)
Although they are using 1.04. Hello? I was all on board until I
saw they haven't upgraded. Wassup widdat?
Is the developer for this site on the list?
Hmmm. Maybe the developer is just getting started with jQuery...
http://www.barackobama.com/js/cmxform.js:
if( document.addEventListener ) document.addEventListener
( 'DOMContentLoaded', cmxform, false );
function cmxform(){
// Hide forms
$( 'form.cmxform' ).hide().end();
// Processing
$( 'form.cmxform' ).find( 'li/label' ).not( '.nocmx' ).each
( function( i ){
var labelContent = this.innerHTML;
var labelWidth = document.defaultView.getComputedStyle( this,
'' ).getPropertyValue( 'width' );
var labelSpan = document.createElement( 'span' );
labelSpan.style.display = 'block';
labelSpan.style.width = labelWidth;
labelSpan.innerHTML = labelContent;
this.style.display = '-moz-inline-box';
this.innerHTML = null;
this.appendChild( labelSpan );
} ).end();
// Show forms
$( 'form.cmxform' ).show().end();
}
Could be done like this...
$(document).ready(function() {
$('form.cmxform li/label').not('.nocmx').each(function(index) {
var labelContent = $(this).html();
var labelWidth = $(this).width();
$(this).empty();
$('<span></span>').html(labelContent).css({display: 'block',
width: labelWidth}).appendTo(this);
});
});
But why would someone need to append a <span> to the label instead of
just styling the label?
And why would someone want to use a <span> and then make it
display:block instead of just using a <div> ?
Maybe I'm missing something?
in jQuery we trust.
Yes, but some trust it more than others. :)
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/