Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !31112

Escape selectors to support HTML5 ID spec

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/Hiws/escape-selectors-to-support-HTML5-spec into main Jun 19, 2020
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: Hiws

This is a rough draft, of a possible simple solution to support HTML5 ID's in combination with the various JS plugins.

This allows the user to use non-alpha characters as the first character in the ID, which is currently not possible.

Basic example of what will be possible:

<a class="nav-link" data-toggle="tab" href="#1-tab">Tab 1</a>

<div class="tab-pane fade" id="1-tab">
  Content
</div>

I've tested Modals, Tabs, Scrollspy, Carousel and Collapse locally via the docs, and it appears to function correctly, but will definitely need more testing to ensure it works across supported browsers and environments. My knowledge of all the ways the plugins above can be used is limited, which is why I'd love some input whether the current draft makes sense.

The selector is escaped using the built-in CSS.escape, function. However, I don't think this is supported in Legacy Edge. So a different solution might be needed here.

Alternatives to native CSS.escape:

  • https://github.com/mathiasbynens/cssesc - Standalone function (with more features?)
  • https://github.com/mathiasbynens/CSS.escape - A direct polyfill
  • Write a standalone function specific to Bootstrap
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/Hiws/escape-selectors-to-support-HTML5-spec