浏览代码

Fixed non-conform HTML-Standard problems

zhixin 4 年之前
父节点
当前提交
f5215554fe

+ 10 - 6
src/bootstrap-table.js

@@ -96,7 +96,7 @@ class BootstrapTable {
       ${loadingTemplate}
       </div>
       </div>
-      <div class="fixed-table-footer"><table><thead><tr></tr></thead></table></div>
+      <div class="fixed-table-footer"></div>
       </div>
       ${bottomPagination}
       </div>
@@ -1180,10 +1180,10 @@ class BootstrapTable {
     }
 
     if (this.paginationParts.includes('pageSize')) {
-      html.push('<span class="page-list">')
+      html.push('<div class="page-list">')
 
       const pageNumber = [
-        `<span class="${this.constants.classes.paginationDropdown}">
+        `<div class="${this.constants.classes.paginationDropdown}">
         <button class="${this.constants.buttonsClass} dropdown-toggle" type="button" ${this.constants.dataToggle}="dropdown">
         <span class="page-size">
         ${allSelected ? opts.formatAllRows() : opts.pageSize}
@@ -1205,13 +1205,13 @@ class BootstrapTable {
           pageNumber.push(Utils.sprintf(this.constants.html.pageDropdownItem, active, page))
         }
       })
-      pageNumber.push(`${this.constants.html.pageDropdown[1]}</span>`)
+      pageNumber.push(`${this.constants.html.pageDropdown[1]}</div>`)
 
       html.push(opts.formatRecordsPerPage(pageNumber.join('')))
     }
 
     if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) {
-      html.push('</span></div>')
+      html.push('</div></div>')
     }
 
     if (this.paginationParts.includes('pageList')) {
@@ -1308,7 +1308,7 @@ class BootstrapTable {
     const dropupClass = ['bottom', 'both'].includes(opts.paginationVAlign) ?
       ` ${this.constants.classes.dropup}` : ''
 
-    this.$pagination.last().find('.page-list > span').addClass(dropupClass)
+    this.$pagination.last().find('.page-list > div').addClass(dropupClass)
 
     if (!opts.onlyInfoPagination) {
       $pageList = this.$pagination.find('.page-list a')
@@ -2222,6 +2222,10 @@ class BootstrapTable {
       this.$tableFooter = this.$el.find('tfoot')
     }
 
+    if (!this.$tableFooter.find('tr').length) {
+      this.$tableFooter.html('<table><thead><tr></tr></thead></table>')
+    }
+
     this.$tableFooter.find('tr').html(html.join(''))
 
     this.trigger('post-footer', this.$tableFooter)

+ 2 - 2
src/extensions/filter-control/utils.js

@@ -240,8 +240,8 @@ export function initFilterSelectControls (that) {
 
     if (isColumnSearchableViaSelect(column) && isFilterDataNotGiven(column) && hasSelectControlElement(selectControl)) {
       if (selectControl.get(selectControl.length - 1).options.length === 0) {
-        // Added the default option
-        addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault)
+        // Added the default option, must use a non-breaking space(&nbsp;) to pass the W3C validator
+        addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder || '&nbsp;', column.filterDefault)
       }
 
       const uniqueValues = {}

+ 4 - 0
src/themes/foundation/bootstrap-table-foundation.scss

@@ -47,6 +47,10 @@
   }
 
   .fixed-table-pagination {
+    .page-list > div {
+      display: inline;
+    }
+
     .button {
       margin-bottom: 0;
     }

+ 4 - 0
src/themes/materialize/bootstrap-table-materialize.scss

@@ -49,6 +49,10 @@
       vertical-align: middle;
     }
 
+    .page-list > div {
+      display: inline;
+    }
+
     .pagination li {
       height: 36px;
     }