@@ -240,7 +240,9 @@ $.extend( Datepicker.prototype, {
240
240
inst . append . remove ( ) ;
241
241
}
242
242
if ( appendText ) {
243
- inst . append = $ ( "<span class='" + this . _appendClass + "'>" + appendText + "</span>" ) ;
243
+ inst . append = $ ( "<span>" )
244
+ . addClass ( this . _appendClass )
245
+ . text ( appendText ) ;
244
246
input [ isRTL ? "before" : "after" ] ( inst . append ) ;
245
247
}
246
248
@@ -257,12 +259,32 @@ $.extend( Datepicker.prototype, {
257
259
if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked
258
260
buttonText = this . _get ( inst , "buttonText" ) ;
259
261
buttonImage = 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'>" )
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
+
266
288
input [ isRTL ? "before" : "after" ] ( inst . trigger ) ;
267
289
inst . trigger . on ( "click" , function ( ) {
268
290
if ( $ . datepicker . _datepickerShowing && $ . datepicker . _lastInput === input [ 0 ] ) {
@@ -1703,32 +1725,104 @@ $.extend( Datepicker.prototype, {
1703
1725
this . _daylightSavingAdjust ( new Date ( drawYear , drawMonth - stepMonths , 1 ) ) ,
1704
1726
this . _getFormatConfig ( inst ) ) ) ;
1705
1727
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>" )
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
+ . addClass ( "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>" )
1746
+ . attr ( {
1747
+ "class" : "ui-datepicker-prev ui-corner-all ui-state-disabled" ,
1748
+ title : prevText
1749
+ } )
1750
+ . append (
1751
+ $ ( "<span>" )
1752
+ . addClass ( "ui-icon ui-icon-circle-triangle-" +
1753
+ ( isRTL ? "e" : "w" ) )
1754
+ . text ( prevText )
1755
+ ) [ 0 ] . outerHTML ;
1756
+ }
1710
1757
1711
1758
nextText = this . _get ( inst , "nextText" ) ;
1712
1759
nextText = ( ! navigationAsDateFormat ? nextText : this . formatDate ( nextText ,
1713
1760
this . _daylightSavingAdjust ( new Date ( drawYear , drawMonth + stepMonths , 1 ) ) ,
1714
1761
this . _getFormatConfig ( inst ) ) ) ;
1715
1762
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>" )
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
+ . addClass ( "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>" )
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
+ }
1720
1792
1721
1793
currentText = this . _get ( inst , "currentText" ) ;
1722
1794
gotoDate = ( this . _get ( inst , "gotoCurrent" ) && inst . currentDay ? currentDate : today ) ;
1723
1795
currentText = ( ! navigationAsDateFormat ? currentText :
1724
1796
this . formatDate ( currentText , gotoDate , this . _getFormatConfig ( inst ) ) ) ;
1725
1797
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>" )
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>" )
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
+ }
1732
1826
1733
1827
firstDay = parseInt ( this . _get ( inst , "firstDay" ) , 10 ) ;
1734
1828
firstDay = ( isNaN ( firstDay ) ? 0 : firstDay ) ;
0 commit comments