Hi,
I have been struggling to get my installation of Ubercart to validate to XHTML 1.0. Two pages cause the problems. These are mysite.com/catalog and mysite.com/cart. I have now managed to solve the problem by changing code in the modules. The changes, and errors, are documented below.
mysite.com/cart
Validation Error: Attribute "alt" exists, but can not be used for this element.
Offending code in uc_cart.module:
Line 577: $output .= '<span class="cart-block-title-bar" alt="'. t('Show/hide shopping cart contents.').'" title="'. t('Show/hide shopping cart contents.') .'">'. $title .'<span class="cart-block-arrow"></span></span>';
Solution:
Line 577: $output .= '<span class="cart-block-title-bar" title="'. t('Show/hide shopping cart contents.') .'">'. $title .'<span class="cart-block-arrow"></span></span>';
Validation Error: Attribute "width" exists, but can not be used for this element.
Offending code in uc_cart.module
Line 1048: $table[$i]['desc']['#cell_attributes'] = array('width' => '100%', 'class' => 'desc');
Solution:
Line 1048: $table[$i]['desc']['#cell_attributes'] = array('class' => 'desc');
Validation Error: Attribute "nowrap" exists, but can not be used for this element.
Offending code in uc_cart.module
Line 1050: $table[$i]['total']['#cell_attributes'] = array('nowrap' => 'nowrap', 'class' => 'price');
Solution:
Line 1050: $table[$i]['total']['#cell_attributes'] = array('class' => 'price');
Validation Error: Attribute "nowrap" exists, but can not be used for this element.
Offending code in uc_cart.module
Line 1064: 'nowrap' => 'nowrap',
Solution:
Line 1064: /* removed */
mysite.com/catalog
Validation Error: Attribute "width" exists, but can not be used for this element.
Offending code in uc_product.module
Line 1258: '#cell_attributes' => array('width' => '100%'),
Solution:
Line 1258: /* removed */
Validation Error: Attribute "nowrap" exists, but can not be used for this element.
Offending code in uc_product.module
Line 1216: 'cell' => array('data' => t('Add to cart'), 'nowrap' => 'nowrap'),
Solution:
Line 1216: 'cell' => array('data' => t('Add to cart')),
After making changes above, all pages appear to validate to XHTML 1.0. Still checking so others may crop up.
Nick
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 492928_xhtml.patch | 2.03 KB | Island Usurper |
| #7 | uc_cart.patch | 1.72 KB | nickbits |
| #7 | uc_product.patch | 798 bytes | nickbits |
Comments
Comment #1
andreiashu commentedHi Nick,
Would it be possible for a patch ?
Thanks !
Comment #2
nickbits commentedHi,
Can you recommend a good Windows tool for creating a patch?
Nick
Comment #3
tr commentedhttp://drupal.org/node/60234
Comment #4
rszrama commentedIn cases where nowrap attributes are removed, can we also see some recommended CSS showing the appropriate
white-space: nowrap;?Comment #5
andreiashu commented@4: http://www.w3schools.com/css/pr_text_white-space.asp :)
Cheers !
Comment #6
rszrama commentedI know how it works. ; ) I just wanted to make sure if any nowrap attributes are removed from HTML that any patch includes the appropriate CSS so that the display of these elements isn't affected.
Comment #7
nickbits commentedHi,
Have used UnixUtils to generate patch files. It's been a while since I generated patch files, forgot how easy it is!
Anyway, the two patches are attached. I have only removed or altered entries to ensure the XHTML code is valid. I have not yet looked at the CSS.
Nick
Comment #8
mikejoconnor commentedComment #9
Island Usurper commentedOK, let's get some CSS to reconstruct the intended styles those attributes provided.
Comment #10
tr commentedDoes this patch eliminate *all* the validation errors on your site? As long as you're addressing the issue, it would be nice to do a complete job of it.
Comment #11
nickbits commented@TR, at present YES. I have not found any other XHTML errors. I am still going through and double checking things, but at present nothing has turned up. It would be nice if others could also check this to ensure that it is a bug and not me just me!!!
Comment #12
rszrama commentedComment #13
Island Usurper commentedIf there aren't any other validation errors, then I guess I can just commit this patch. It combines the two files in #7 and adds the CSS needed to keep the same styles.