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
  • !114

First cut of selector optimization (issue #100)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/karthikv/selector-optimization into master Aug 28, 2011
  • Overview 0
  • Commits 5
  • Pipelines 0
  • Changes 7

Created by: karthikv

As per my description on issue #100 (closed), selectors like these:

.topbar form input
.pagination ul li a
.topbar ul li ul li a
.tabs li a

should be replaced by more efficient and simplified counterparts that don't have prodigal descendants:

.topbar input
.pagination ul a /* or */ .pagination li a
.topbar ul ul a /* or */ .topbar li li a
.tabs a

The commits associated with this pull request achieve many optimizations similar to the ones above in all LESS files that need them. In addition to the aforementioned examples, selectors with non-generic class names as descendants, like so:

.modal .modal-body
table .headerSortUp

have also been optimized by simply removing the parent selector:

.modal-body
.headerSortUp

This has only been done where class names are unique and quite unlikely to be re-used elsewhere.

In terms of statistics, five of the eight LESS files benefited from these optimizations, many in a significant manner. More than just greater efficiency, this also cut down about 700 bytes (~2%) from the minified stylesheet. Considering that the only change was to selectors, I would say this is a nice bonus.

Even though this takes care of many optimizations, there are still various methods to accomplish even more. For example, because a decent number of class names are generic, the selectors including them require more context and therefore more complexity. Changing the markup to supplant optimization and circumvent these cases is a frontier not explored in these commits. Re-thinking the CSS structure as a whole can also result in insights of what can be consolidated. For these reasons, I ask that you continue to keep issue #100 (closed) open so that further optimization—and discussion regarding it—is continually strived for.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/karthikv/selector-optimization