@@ -240,7 +240,9 @@ $.extend( Datepicker.prototype, {
240240inst . append . remove ( ) ;
241241}
242242if ( appendText ) {
243- inst . append = $ ( "<span class='" + this . _appendClass + "'>" + appendText + "</span>" ) ;
243+ inst . append = $ ( "<span></span>" )
244+ . attr ( "class" , this . _appendClass )
245+ . text ( appendText ) ;
244246input [ isRTL ? "before" : "after" ] ( inst . append ) ;
245247}
246248
@@ -257,12 +259,32 @@ $.extend( Datepicker.prototype, {
257259if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked
258260buttonText = this . _get ( inst , "buttonText" ) ;
259261buttonImage = this . _get ( inst , "buttonImage" ) ;
260- inst . trigger = $ ( this . _get ( inst , "buttonImageOnly" ) ?
261- $ ( "<img/>" ) . addClass ( this . _triggerClass ) .
262- attr ( { src : buttonImage , alt : buttonText , title : buttonText } ) :
263- $ ( "<button type='button'></button>" ) . addClass ( this . _triggerClass ) .
264- html ( ! buttonImage ? buttonText : $ ( "<img/>" ) . attr (
265- { src :buttonImage , alt :buttonText , title :buttonText } ) ) ) ;
262+
263+ if ( this . _get ( inst , "buttonImageOnly" ) ) {
264+ inst . trigger = $ ( "<img/>" )
265+ . addClass ( this . _triggerClass )
266+ . attr ( {
267+ src : buttonImage ,
268+ alt : buttonText ,
269+ title : buttonText
270+ } ) ;
271+ } else {
272+ inst . trigger = $ ( "<button type='button'></button>" )
273+ . addClass ( this . _triggerClass ) ;
274+ if ( buttonImage ) {
275+ inst . trigger . html (
276+ $ ( "<img/>" )
277+ . attr ( {
278+ src : buttonImage ,
279+ alt : buttonText ,
280+ title : buttonText
281+ } )
282+ ) ;
283+ } else {
284+ inst . trigger . text ( buttonText ) ;
285+ }
286+ }
287+
266288input [ isRTL ? "before" : "after" ] ( inst . trigger ) ;
267289inst . trigger . on ( "click" , function ( ) {
268290if ( $ . datepicker . _datepickerShowing && $ . datepicker . _lastInput === input [ 0 ] ) {
@@ -1703,32 +1725,104 @@ $.extend( Datepicker.prototype, {
17031725this . _daylightSavingAdjust ( new Date ( drawYear , drawMonth - stepMonths , 1 ) ) ,
17041726this . _getFormatConfig ( inst ) ) ) ;
17051727
1706- prev = ( this . _canAdjustMonth ( inst , - 1 , drawYear , drawMonth ) ?
1707- "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
1708- " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" :
1709- ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" ) ) ;
1728+ if ( this . _canAdjustMonth ( inst , - 1 , drawYear , drawMonth ) ) {
1729+ prev = $ ( "<a></a>" )
1730+ . attr ( {
1731+ "class" : "ui-datepicker-prev ui-corner-all" ,
1732+ "data-handler" : "prev" ,
1733+ "data-event" : "click" ,
1734+ title : prevText
1735+ } )
1736+ . append (
1737+ $ ( "<span>" )
1738+ . attr ( "class" , "ui-icon ui-icon-circle-triangle-" +
1739+ ( isRTL ? "e" : "w" ) )
1740+ . text ( prevText )
1741+ ) [ 0 ] . outerHTML ;
1742+ } else if ( hideIfNoPrevNext ) {
1743+ prev = "" ;
1744+ } else {
1745+ prev = $ ( "<a></a>" )
1746+ . attr ( {
1747+ "class" : "ui-datepicker-prev ui-corner-all ui-state-disabled" ,
1748+ title : prevText
1749+ } )
1750+ . append (
1751+ $ ( "<span>" )
1752+ . attr ( "class" , "ui-icon ui-icon-circle-triangle-" +
1753+ ( isRTL ? "e" : "w" ) )
1754+ . text ( prevText )
1755+ ) [ 0 ] . outerHTML ;
1756+ }
17101757
17111758nextText = this . _get ( inst , "nextText" ) ;
17121759nextText = ( ! navigationAsDateFormat ? nextText : this . formatDate ( nextText ,
17131760this . _daylightSavingAdjust ( new Date ( drawYear , drawMonth + stepMonths , 1 ) ) ,
17141761this . _getFormatConfig ( inst ) ) ) ;
17151762
1716- next = ( this . _canAdjustMonth ( inst , + 1 , drawYear , drawMonth ) ?
1717- "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
1718- " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" :
1719- ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" ) ) ;
1763+ if ( this . _canAdjustMonth ( inst , + 1 , drawYear , drawMonth ) ) {
1764+ next = $ ( "<a></a>" )
1765+ . attr ( {
1766+ "class" : "ui-datepicker-next ui-corner-all" ,
1767+ "data-handler" : "next" ,
1768+ "data-event" : "click" ,
1769+ title : nextText
1770+ } )
1771+ . append (
1772+ $ ( "<span>" )
1773+ . attr ( "class" , "ui-icon ui-icon-circle-triangle-" +
1774+ ( isRTL ? "w" : "e" ) )
1775+ . text ( nextText )
1776+ ) [ 0 ] . outerHTML ;
1777+ } else if ( hideIfNoPrevNext ) {
1778+ next = "" ;
1779+ } else {
1780+ next = $ ( "<a></a>" )
1781+ . attr ( {
1782+ "class" : "ui-datepicker-next ui-corner-all ui-state-disabled" ,
1783+ title : nextText
1784+ } )
1785+ . append (
1786+ $ ( "<span>" )
1787+ . attr ( "class" , "ui-icon ui-icon-circle-triangle-" +
1788+ ( isRTL ? "w" : "e" ) )
1789+ . text ( nextText )
1790+ ) [ 0 ] . outerHTML ;
1791+ }
17201792
17211793currentText = this . _get ( inst , "currentText" ) ;
17221794gotoDate = ( this . _get ( inst , "gotoCurrent" ) && inst . currentDay ? currentDate : today ) ;
17231795currentText = ( ! navigationAsDateFormat ? currentText :
17241796this . formatDate ( currentText , gotoDate , this . _getFormatConfig ( inst ) ) ) ;
17251797
1726- controls = ( ! inst . inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
1727- this . _get ( inst , "closeText" ) + "</button>" : "" ) ;
1728-
1729- buttonPanel = ( showButtonPanel ) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + ( isRTL ? controls : "" ) +
1730- ( this . _isInRange ( inst , gotoDate ) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
1731- ">" + currentText + "</button>" : "" ) + ( isRTL ? "" : controls ) + "</div>" : "" ;
1798+ controls = "" ;
1799+ if ( ! inst . inline ) {
1800+ controls = $ ( "<button></button>" )
1801+ . attr ( {
1802+ type : "button" ,
1803+ "class" : "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" ,
1804+ "data-handler" : "hide" ,
1805+ "data-event" : "click"
1806+ } )
1807+ . text ( this . _get ( inst , "closeText" ) ) [ 0 ] . outerHTML ;
1808+ }
1809+
1810+ buttonPanel = "" ;
1811+ if ( showButtonPanel ) {
1812+ buttonPanel = $ ( "<div class='ui-datepicker-buttonpane ui-widget-content'>" )
1813+ . append ( isRTL ? controls : "" )
1814+ . append ( this . _isInRange ( inst , gotoDate ) ?
1815+ $ ( "<button></button>" )
1816+ . attr ( {
1817+ type : "button" ,
1818+ "class" : "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" ,
1819+ "data-handler" : "today" ,
1820+ "data-event" : "click"
1821+ } )
1822+ . text ( currentText ) :
1823+ "" )
1824+ . append ( isRTL ? "" : controls ) [ 0 ] . outerHTML ;
1825+ }
17321826
17331827firstDay = parseInt ( this . _get ( inst , "firstDay" ) , 10 ) ;
17341828firstDay = ( isNaN ( firstDay ) ? 0 : firstDay ) ;
0 commit comments