mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 21:26:10 +03:00
Don't overwrite the element's id if it has one already
This commit is contained in:
parent
4a877d60f7
commit
9772901d71
@ -32,6 +32,8 @@
|
|||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const { option } = require("grunt");
|
||||||
|
|
||||||
(function( $ ){
|
(function( $ ){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,9 +62,15 @@ $.Navigator = function( options ){
|
|||||||
if ( options.element ) {
|
if ( options.element ) {
|
||||||
if ( options.id ){
|
if ( options.id ){
|
||||||
$.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead.");
|
$.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead.");
|
||||||
|
} else {
|
||||||
|
// Don't overwrite the element's id if it has one already
|
||||||
|
if ( option.element.id ) {
|
||||||
|
options.id = option.element.id;
|
||||||
|
} else {
|
||||||
|
options.id = 'navigator-' + $.now();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
options.id = 'navigator-' + $.now();
|
|
||||||
this.element = options.element;
|
this.element = options.element;
|
||||||
} else {
|
} else {
|
||||||
this.element = document.getElementById( options.id );
|
this.element = document.getElementById( options.id );
|
||||||
|
Loading…
Reference in New Issue
Block a user