Skip to content

Commit 5bff735

Browse files
committed
Adjusted Order of Precedence for Parent
Now allows explicit selection of parent, then data attribute, then defaults to selector object if CSS background image being used, then immediate parent object
1 parent cfe1ec0 commit 5bff735

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

dist/jquery.adaptive-backgrounds.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/jquery.adaptive-backgrounds.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@
6969
var $data = data;
7070
var $parent;
7171

72-
if ( useCSSBackground() ){
73-
$parent = $this;
72+
if ( opts.parent && $this.parents( opts.parent ).length ) {
73+
$parent = $this.parents( opts.parent );
7474
}
75-
else if ( $this.attr( DATA_PARENT ) ){
75+
else if ( $this.attr( DATA_PARENT ) && $this.parents( $this.attr( DATA_PARENT ) ).length ){
7676
$parent = $this.parents( $this.attr( DATA_PARENT ) );
7777
}
78-
else if (opts.parent) {
79-
$parent = $this.parents( opts.parent );
78+
else if ( useCSSBackground() ){
79+
$parent = $this;
8080
}
8181
else {
8282
$parent = $this.parent();

0 commit comments

Comments
 (0)