Permalink
Browse files

fixing a typo and making the css discovery more robust

  • Loading branch information...
1 parent 6ff9b82 commit c7c3dbf596f3e6d2fb8125e6511834b5dd484735 @heygrady committed Dec 21, 2011
Showing with 14 additions and 7 deletions.
  1. +2 −2 jquery.textshadow.css
  2. +12 −5 jquery.textshadow.js
View
4 jquery.textshadow.css
@@ -2,12 +2,12 @@
position: relative;
}
.ui-text-shadow-original {
- z-index: 2;
+ z-index: 1;
text-shadow: none;
}
.ui-text-shadow-copy {
position: absolute;
- z-index: 1;
+ z-index: 0;
/* default positioning */
left: 0;
View
17 jquery.textshadow.js
@@ -12,7 +12,7 @@
value = null;
}
var opts = options || {};
- var useStyle = opts.useStyle || false;
+ var useStyle = opts.useStyle === false ? false : true;
// loop the found items
return this.each(function() {
@@ -28,7 +28,7 @@
$copy = $elem.find('.ui-text-shadow-copy');
}
if (useStyle) {
- applyStyles($elem, $copy, value);
+ applyStyles($copy, value);
}
});
};
@@ -109,11 +109,18 @@
//---------------------
// For Applying Styles
//---------------------
- function applyStyles($elem, $copy, value) {
+ function applyStyles($copy, value) {
$copy.each(function() {
var copy = this,
- style = value || $elem[0].currentStyle['text-shadow'];
- $copy = $(copy);
+ style = value || copy.currentStyle['text-shadow'],
+ $copy = $(copy),
+ parent = copy.parentNode;
+
+ // ensure we have the correct style
+ while ((!style || style === 'none') && parent.nodeName !== 'HTML') {
+ style = parent.currentStyle['text-shadow'];
+ parent = parent.parentNode;
+ }
// don't apply style if we can't find one
if (!style || style === 'none') {

0 comments on commit c7c3dbf

Please sign in to comment.