Make OpenSeadragon W3C compliant.

This commit is contained in:
Antoine Vandecreme 2014-04-04 16:14:32 -04:00
parent f18909d0ec
commit f7d65fa4cb
7 changed files with 19 additions and 15 deletions

View File

@ -120,18 +120,23 @@ $.Button = function( options ) {
* @member {Element} element * @member {Element} element
* @memberof OpenSeadragon.Button# * @memberof OpenSeadragon.Button#
*/ */
this.element = options.element || $.makeNeutralElement( "button" ); this.element = options.element || $.makeNeutralElement( "div" );
//if the user has specified the element to bind the control to explicitly //if the user has specified the element to bind the control to explicitly
//then do not add the default control images //then do not add the default control images
if( !options.element ){ if ( !options.element ) {
this.imgRest = $.makeTransparentImage( this.srcRest ); this.imgRest = $.makeTransparentImage( this.srcRest );
this.imgGroup = $.makeTransparentImage( this.srcGroup ); this.imgGroup = $.makeTransparentImage( this.srcGroup );
this.imgHover = $.makeTransparentImage( this.srcHover ); this.imgHover = $.makeTransparentImage( this.srcHover );
this.imgDown = $.makeTransparentImage( this.srcDown ); this.imgDown = $.makeTransparentImage( this.srcDown );
this.imgDiv = $.makeNeutralElement( "div" );
this.imgDiv.style.position = "relative"; this.imgRest.alt =
this.imgGroup.alt =
this.imgHover.alt =
this.imgDown.alt =
this.tooltip;
this.element.style.position = "relative";
this.imgGroup.style.position = this.imgGroup.style.position =
this.imgHover.style.position = this.imgHover.style.position =
@ -159,11 +164,10 @@ $.Button = function( options ) {
""; "";
} }
this.imgDiv.appendChild( this.imgRest ); this.element.appendChild( this.imgRest );
this.imgDiv.appendChild( this.imgGroup ); this.element.appendChild( this.imgGroup );
this.imgDiv.appendChild( this.imgHover ); this.element.appendChild( this.imgHover );
this.imgDiv.appendChild( this.imgDown ); this.element.appendChild( this.imgDown );
this.element.appendChild( this.imgDiv );
} }

View File

@ -66,7 +66,7 @@ $.ButtonGroup = function( options ) {
* @member {Element} element * @member {Element} element
* @memberof OpenSeadragon.ButtonGroup# * @memberof OpenSeadragon.ButtonGroup#
*/ */
this.element = options.element || $.makeNeutralElement( "fieldgroup" ); this.element = options.element || $.makeNeutralElement( "div" );
// TODO What if there IS an options.group specified? // TODO What if there IS an options.group specified?
if( !options.group ){ if( !options.group ){

View File

@ -128,7 +128,7 @@ $.Control = function ( element, options, container ) {
this.element.style.height = "100%"; this.element.style.height = "100%";
this.element.style.width = "100%"; this.element.style.width = "100%";
} else { } else {
this.wrapper = $.makeNeutralElement( "span" ); this.wrapper = $.makeNeutralElement( "div" );
this.wrapper.style.display = "inline-block"; this.wrapper.style.display = "inline-block";
if ( this.anchor == $.ControlAnchor.NONE ) { if ( this.anchor == $.ControlAnchor.NONE ) {
// IE6 fix // IE6 fix

View File

@ -46,7 +46,7 @@
$.extend( true, this, { $.extend( true, this, {
id: 'controldock-'+$.now()+'-'+Math.floor(Math.random()*1000000), id: 'controldock-'+$.now()+'-'+Math.floor(Math.random()*1000000),
container: $.makeNeutralElement('form'), container: $.makeNeutralElement( 'div' ),
controls: [] controls: []
}, options ); }, options );

View File

@ -201,7 +201,7 @@ $.Navigator = function( options ){
$.Viewer.apply( this, [ options ] ); $.Viewer.apply( this, [ options ] );
this.element.getElementsByTagName('form')[0].appendChild( this.displayRegion ); this.element.getElementsByTagName( 'div' )[0].appendChild( this.displayRegion );
unneededElement = this.element.getElementsByTagName('textarea')[0]; unneededElement = this.element.getElementsByTagName('textarea')[0];
if (unneededElement) { if (unneededElement) {
unneededElement.parentNode.removeChild(unneededElement); unneededElement.parentNode.removeChild(unneededElement);

View File

@ -447,7 +447,7 @@ function loadPanels( strip, viewerSize, scroll ) {
element: miniViewer.displayRegion element: miniViewer.displayRegion
} ); } );
element.getElementsByTagName( 'form' )[0].appendChild( element.getElementsByTagName( 'div' )[0].appendChild(
miniViewer.displayRegion miniViewer.displayRegion
); );

View File

@ -102,7 +102,7 @@ $.Viewer = function( options ) {
*/ */
element: null, element: null,
/** /**
* A &lt;form&gt; element (provided by {@link OpenSeadragon.ControlDock}), the base element of this Viewer instance.<br><br> * A &lt;div&gt; element (provided by {@link OpenSeadragon.ControlDock}), the base element of this Viewer instance.<br><br>
* Child element of {@link OpenSeadragon.Viewer#element}. * Child element of {@link OpenSeadragon.Viewer#element}.
* @member {Element} container * @member {Element} container
* @memberof OpenSeadragon.Viewer# * @memberof OpenSeadragon.Viewer#