Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow Unqualified Attribute Selectors #610

Open
FMCalisto opened this issue Mar 1, 2016 · 1 comment
Open

Slow Unqualified Attribute Selectors #610

FMCalisto opened this issue Mar 1, 2016 · 1 comment

Comments

@FMCalisto
Copy link

Unqualified attribute selectors are known to be slow, so it might be interesting to avoid the use of unqualified attribute selectors.

Why is this an issue?

Unqualified attribute selectors, such as the one bellow, match all the page before check their attributes. So, like the universal selector they evaluate selectors from right to left.

Ex:

 .ex-class [type=text] {
   font-size: 16px;
 }

Source

/*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */article,aside,details,figcaption,figure,footer,header,hgroup,nav,section,summary{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}button,html,input,select,textarea{font-family:sans-serif}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}h2{font-size:1.5em;margin:.83em 0}h3{font-size:1.17em;margin:1em 0}h4{font-size:1em;margin:1.33em 0}h5{font-size:.83em;margin:1.67em 0}h6{font-size:.75em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}blockquote{margin:1em 40px}dfn{font-style:italic}mark{background:#ff0;color:#000}p,pre{margin:1em 0}code,kbd,pre,samp{font-family:monospace;_font-family:courier new,monospace;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}q{quotes:none}q:after,q:before{content:'';content:none}small,sub,sup{font-size:75%}sub,sup{line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}dl,menu,ol,ul{margin:1em 0}dd{margin:0 0 0 40px}menu,ol,ul{padding:0 0 0 40px}nav ol,nav ul{list-style:none;list-style-image:none}img{border:0;-ms-interpolation-mode:bicubic}svg:not(:root){overflow:hidden}figure,form{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0;white-space:normal;*margin-left:-7px}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}button,input{line-height:normal}button,input[type=button],input[type=reset],input[type=submit]{cursor:pointer;-webkit-appearance:button;*overflow:visible}button[disabled],input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0;*height:13px;*width:13px}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}/*! HTML5 Boilerplate v4.3.0 | MIT License | http://h5bp.com/ */button,html,input,select,textarea{color:#222}html{font-size:1em;line-height:1.4}::-moz-selection{background:#b3d4fc;text-shadow:none}::selection{background:#b3d4fc;text-shadow:none}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}audio,canvas,img,video{vertical-align:middle}fieldset{border:0;margin:0;padding:0}textarea{resize:vertical}body,html{height:100%}html{font-family:Roboto,sans-serif}h1,h2,h3,h4,h5,h6{font-family:Roboto Slab,serif}h2,h3,h4,h5,h6{margin-top:2em}h5,h6{margin-bottom:0}p,pre{margin-bottom:1.3em}a{cursor:pointer}code{padding:.2em .4em;background:#f8f8f8;border:1px solid #ddd;line-height:1;border-radius:3px}code.prettyprint{padding:0}.btn{padding:.8em 1.2em;background:#5aadbb;border-radius:3px;color:#fff;text-decoration:none;text-shadow:1px 1px 3px rgba(0,0,0,.5)}.btn:hover{background:#3398a9}blockquote{background:#f9f9f9;border-left:10px solid #ccc;margin:1.5em 10px;padding:.5em 10px;quotes:"\201C""\201D""\2018""\2019"}blockquote:before{color:#ccc;content:open-quote;font-size:4em;line-height:.1em;margin-right:.05em;vertical-align:-.4em}blockquote p{display:inline}.SiteWrapper{overflow:hidden}.page-header .mobile-bar{position:fixed;top:0;left:0;z-index:12;width:100%;height:3em;background:#1f1f1f}.page-header .container{position:relative}.logo{position:absolute;top:-.05em;left:.3em;width:3.5em;margin:0;padding:0;line-height:normal}.logo img{max-width:100%}.mobile-menu-toggle{display:block;position:absolute;z-index:2;top:0;right:0;width:3em;height:3em;background:url(/static/icon-menu.91fc544b79.png) no-repeat 50% 50%}.mobile-menu-toggle:active,.mobile-menu-toggle:focus{outline:none}.open .mobile-menu-toggle{opacity:.5}.page-header ul{margin:0;padding:0}.main-menu{display:none;position:fixed;top:48px;bottom:0;right:0;left:0;z-index:10;overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch}.open .main-menu{display:block}.main-nav{font-size:.9em;background:#000}.main-nav a{display:block;padding:1em;border-bottom:1px dotted hsla(0,0%,100%,.2);color:#fff;text-decoration:none;transition:all .3s ease}.main-nav a.active{color:#5aadbb;font-weight:700}.main-nav a:hover{background:hsla(0,0%,100%,.1)}.main-nav a:active{background:hsla(0,0%,100%,.17)}.main-nav>li>ul a{padding:.75em 1em .75em 2em}.main-nav>li>ul a:before{content:' - '}.jumbotron{margin:0 0 3em;padding-top:4.3em;text-align:center;background:#5aadbb}.jumbotron h2{margin:0 1em;font-weight:400;font-size:1em;color:#fff;text-transform:uppercase;letter-spacing:.1em}.illustration{position:relative;top:1.3em;max-width:100%}#content{min-height:100%}.main{padding:0 1.3em;font-size:1em;line-height:1.6}.main img{max-width:100%;height:auto}.main a{color:#0096c7}.main a:hover{text-decoration:none}.section-title{padding:.3em 0;border-bottom:4px solid rgba(215,0,41,.1)}.content-chunk{margin-bottom:4em}.content-chunk p:first-child{margin-top:0}.excerpt{margin:1.8em 0;padding:0 2em;font-size:1.2em;color:#5aadbb;font-style:italic}.excerpt a{color:#006080}.content-chunk h1,.content-chunk h2,.content-chunk h3,.content-chunk h4,.content-chunk h5,.content-chunk h6{position:relative}.content-chunk h1:hover,.content-chunk h2:hover,.content-chunk h3:hover,.content-chunk h4:hover,.content-chunk h5:hover,.content-chunk h6:hover{color:#000;border-color:rgba(215,0,41,.2)}.anchor{display:none;position:absolute;top:50%;left:-24px;margin-top:-18px;padding-right:15px}:hover>.anchor{display:block}.one-line-install{margin-bottom:3em}.one-line-install pre{padding:.5em 1em;background:#bfe6ed;border-radius:.35em}.basic-tools{margin:0;padding:0;list-style:none}.basic-tools li{margin-bottom:2em}.basic-tools li:last-child{margin-bottom:1em}.basic-tools .tool-content{font-size:.9em}.basic-tools .tool-logo{display:block;margin-bottom:.5em;padding:1em;text-align:center;transition:all .3s ease}.basic-tools .yo{background:#f0f0f0}.basic-tools .yo:hover{background:hsla(0,0%,94%,.6)}.basic-tools .grunt{background:#fba919}.basic-tools .grunt:hover{background:rgba(251,169,25,.6)}.basic-tools .bower{background:#ffcc2f}.basic-tools .bower:hover{background:rgba(255,204,47,.6)}.basic-tools .tool-logo:active{box-shadow:inset 0 0 15px rgba(0,0,0,.2)}.basic-tools .tool-logo img{max-width:7em}.team{margin:0 0 1em;padding:0;list-style:none}.team a{display:block;padding:.5em 1.5em;border-bottom:1px dotted rgba(0,0,0,.2);text-decoration:none;transition:all .5s ease}.team li:last-child a{border:none}.team a:active,.team a:hover{background:#bfe6ed;color:#207d8d;text-decoration:none}.team img{max-width:3em;margin-right:1em;border-radius:50%}.page-title{margin-top:0;margin-bottom:2em;padding:4.6em 0 2em;background:#5aadbb;font-size:1em;line-height:1em;color:#fff;text-align:center;font-weight:400;text-transform:uppercase}.context-nav{padding:0 1.2em}.context-nav ul{margin:0;padding:0;list-style:none}.context-nav ul>li{display:none}.context-nav.open ul>li{display:block}.context-nav ul>li .active{position:relative}.context-nav ul>li .active:after{top:1.05em;right:1em;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none;border-top-color:#fff;border-width:.4em}.context-nav.open ul>li .active:after{opacity:.4}.context-nav a{display:block;cursor:pointer;padding:.5em 1em;border-bottom:1px dotted rgba(0,0,0,.2);text-decoration:none;color:#0096c7;transition:all .5s ease}.context-nav a:active,.context-nav a:hover{background:#bfe6ed;color:#207d8d;text-decoration:none}.context-nav ul>li .active{color:#fff;background:#5aadbb;font-style:italic}.context-nav.open ul>li .active,.context-nav ul>li .active:hover{background:#228596}.year_divider>ul{display:none}.year_divider.open>ul{display:block}.year_divider li a{padding-left:1.5em}.context-nav.navbar-fixed{position:fixed;top:7.7em}code .str,pre .str{color:#65b042}code .kwd,pre .kwd{color:#e28964}code .com,pre .com{color:#aeaeae;font-style:italic}code .typ,pre .typ{color:#89bdff}code .lit,pre .lit{color:#3387cc}code .pln,code .pun,pre .pln,pre .pun{color:#fff}code .tag,pre .tag{color:#89bdff}code .atn,pre .atn{color:#bdb76b}code .atv,pre .atv{color:#65b042}code .dec,pre .dec{color:#3387cc}.highlight>pre,code.prettyprint{font-size:.95em;background-color:#2e2e2e;border-radius:.35em}.highlight>pre{padding:1em;overflow:auto;word-wrap:normal}.highlight>pre code{font-size:1em;white-space:pre;background-color:transparent;border:none;border-right:none}pre>code.language-sh:before{content:'$';margin-right:5px}ol.linenums{margin-top:0;margin-bottom:0;color:#aeaeae}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}.contribute-doc{margin-top:2em;padding:.5em 1em;font-size:.9em;border:1px solid #ddd;background:#efefef;border-radius:.35em}#search-notfound{display:none;font-size:1.5em;padding:20px;text-align:center}#plugins-all>table{width:100%}.discovery-page th{cursor:pointer}.discovery-page th.sort{text-align:left}.discovery-page th.sort:before{content:'\21C5';display:inline-block;opacity:.4;font-size:.8em;margin-right:3px}.discovery-page th.sort.asc:before,.discovery-page th.sort.desc:before{opacity:1;margin-right:7px}.discovery-page th.sort.asc:before{content:'\2193';text-align:left}.discovery-page th.sort.desc:before{content:'\2191';text-align:right}.discovery-page td{padding:10px 5px;border-top:1px solid #ddd;position:relative;vertical-align:top}.discovery-page tr.official td.generator-item:before{content:'';position:absolute;top:50%;left:-25px;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:20px;height:7px;background:url(/static/mustache.d62b915ab6.svg) no-repeat;opacity:.5}.discovery-page td.generator-item a{text-decoration:none}.discovery-page td.generator-item a:hover{text-decoration:underline}.discovery-page .name-info .name{font-size:larger}.discovery-page .name-author{font-size:small;margin-left:20px}.discovery-page .description{font-size:smaller}.discovery-page td.metadata{font-size:smaller;text-align:right}.discovery-page th.metadata{font-size:.9em;text-align:right;width:85px}.discovery-page th.last-updated{width:125px}.discovery-page input.search{width:100%;line-height:1.5em;margin:20px 0;font-size:20px;padding:10px;box-sizing:border-box}.blog-post-preview{border-bottom:1px solid #dfdfdf;padding-bottom:1em;margin-bottom:1em}.blog-post-preview .blog-post-title{margin:1em 0 .2em}.blog-post-preview .blog-post-title a{color:#222;text-decoration:none}.blog-post-preview .blog-post-date{margin:.2em 0 1em;font-size:.8em;color:#444;text-decoration:none}.note{background:#f2dede;padding:15px}@media print{code .str,pre .str{color:#060}code .kwd,pre .kwd{color:#006;font-weight:700}code .com,pre .com{color:#600;font-style:italic}code .typ,pre .typ{color:#404;font-weight:700}code .lit,pre .lit{color:#044}code .pun,pre .pun{color:#440}code .pln,pre .pln{color:#000}code .tag,pre .tag{color:#006;font-weight:700}code .atn,pre .atn{color:#404}code .atv,pre .atv{color:#060}}.faq-page a[name]{position:absolute;top:-3em}@media only screen and (min-width:60em){.faq-page a[name]{top:-5em}}.ir{background-color:transparent;border:0;overflow:hidden;*text-indent:-9999px}.ir:before{content:"";display:block;width:0;height:150%}.hidden{display:none!important;visibility:hidden}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.invisible{visibility:hidden}.clearfix:after,.clearfix:before{content:" ";display:table}.clearfix:after{clear:both}.clearfix{*zoom:1}.video-container{position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden}.video-container embed,.video-container iframe,.video-container object{position:absolute;top:0;left:0;width:100%;height:100%}@media only screen and (min-width:20em){.logo a:before{display:block;top:-.5em;left:-1.3em;position:absolute;width:2.35em;height:2.35em;content:"";background:url(/static/yeoman-02.dc21b7fc1d.png) no-repeat;background-size:100%}.logo img{margin-left:1.2em}.page-title{margin-bottom:1.7em}.blog-post-meta .date{float:left}.blog-post-meta .social{float:right}}@media only screen and (min-width:28em){.jumbotron{padding-top:5em}.jumbotron h2{font-size:1.4em;margin-bottom:.5em}.page-title{margin-bottom:1.4em;padding:3.5em 0 1.7em;font-size:1.5em}.main{font-size:1.2em}.basic-tools li{overflow:hidden}.basic-tools .tool-logo{float:left;width:42%;padding:14px;margin:0 3% 0 0;box-sizing:border-box}.basic-tools .tool-content{display:block;float:left;width:50%}.team img{max-width:5em}}@media only screen and (min-width:35em){.jumbotron h2{font-size:1.6em}.illustration{top:1.5em}.page-title{margin-bottom:1.2em;padding:2.3em 0 1em;font-size:2em}.main{font-size:1.3em}.team{overflow:hidden}.team li{display:inline-block;width:32%;margin-right:2%;margin-bottom:2em;font-size:.8em}.team li:nth-child(3n){margin-right:0}.team a{padding:0;border:none}.team a:hover{background:none}.team img{float:none;width:100%;max-width:100%;border-radius:0}.context-nav{max-width:25em}}@media only screen and (min-width:46em){.main-menu{position:relative;z-index:13;top:0;display:block;float:right;overflow:visible}.page-header{position:fixed;top:0;left:0;right:0;background:#1f1f1f;z-index:12}.mobile-bar{position:static}.mobile-menu-toggle{display:none}.main-nav>li{position:relative;float:left;vertical-align:bottom}.main-nav>li:hover{background:hsla(0,0%,100%,.1);transition:all .8s ease}.main-nav a{border:none;padding:1em .7em}.main-nav>li>ul{display:none;position:absolute;top:100%;left:0;min-width:100%;background:#000}.main-nav>li:last-child>ul{left:auto;right:0}.main-nav>li:hover>ul{display:block}.main-nav>li>ul a{padding:15px 20px;white-space:nowrap;border-left:10px solid rgba(221,0,42,0);transition:all .3s ease}.main-nav>li>ul a:hover{border-left-color:#dd002a}.main-nav>li>ul a:before{content:''}.jumbotron h2{font-size:2em;line-height:1.2em}.page-title{margin-bottom:1.5em;padding:0;text-align:left;font-size:2.4em}.page-title .container{display:block;max-width:1200px;margin:0 auto;padding:2.5em 5em 1.6em .6em;background:#5aadbb url(/static/rocket.7cb8adc98d.png) 97% 70% no-repeat;background-size:4em auto;box-sizing:border-box}.team li{width:23.5%}.team li,.team li:nth-child(3n){margin-right:2%}.team li:nth-child(4n){margin-right:0}}@media only screen and (min-width:50em){.main-nav a{padding:1em}.jumbotron{margin-bottom:4em}.illustration{top:2em}.main{font-size:1.4em}}@media only screen and (min-width:55em){.jumbotron{padding-top:6em}.jumbotron h2{font-size:2.6em}.one-line-install{padding:2em 2em 1em;vertical-align:top;border:1px dashed #ccc;background:#eee;-webkit-column-count:2;-moz-column-count:2;column-count:2;-webkit-column-gap:3em;-moz-column-gap:3em;column-gap:3em}.one-line-install p:first-child{margin-top:0}.one-line-install pre{background:#b2d7dd}.main{font-size:1.1em;padding:1em 2em 1em 1.3em}.main-container .main{padding-top:0}}@media only screen and (min-width:60em){.container{position:relative;max-width:1200px;margin:0 auto}.has-sidebar{padding-right:20em;box-sizing:border-box}.main-menu{height:5em}.logo{top:.4em;width:4.5em}.logo a:before{top:-1em;left:0;width:3.5em;height:3.5em}.logo img{margin-left:3.6em}.page-header nav{top:0}.main-nav>li>a{padding:2.1em 1.4em}.main-nav>li>ul{top:100%;min-width:200px}.jumbotron{position:relative;padding-top:8em}.jumbotron h2{float:left;width:40%;margin:0 0 0 5%;text-align:left;font-size:3em}.illustration{float:right;width:53%;margin-right:2%}.page-title{margin-bottom:.7em}.page-title .container{padding-top:3.4em;background-position:97% 78%;background-size:5em auto}.main{line-height:1.6}.context-nav{position:absolute;top:1.3em;right:0;width:17em;margin:0;padding:0}.context-nav ul>li{display:block}.context-nav ul>li .active:after{display:none}.basic-tools li{float:left;width:31%;margin-right:2%;margin-bottom:0;line-height:1.5em}.basic-tools .tool-content,.basic-tools .tool-logo{float:none;width:100%;margin:0 0 1em}.section-tools{float:left;width:63%}.section-team{float:right;width:30%}.basic-tools li{width:28%;margin-right:4%}.team a{display:block;padding:.5em 1.5em;border-bottom:1px dotted rgba(0,0,0,.2);text-decoration:none}.team li{float:none;width:100%;margin:0}.team li:nth-child(3n),.team li:nth-child(4n){margin:0}.team li:last-child a{border:none}.team a:active,.team a:hover{background:#bfe6ed;color:#207d8d;text-decoration:none}.team img{max-width:5em;margin-right:1em;border-radius:50%}}@media only screen and (min-width:65em){.main-nav>li>a{padding:2.1em 2em}}@media print{*{background:transparent!important;color:#000!important;box-shadow:none!important;text-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="#"]:after,a[href^="javascript:"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}@page{margin:.5cm}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}}.SiteFooter{background:#000;padding:20px;display:-webkit-flex;display:-ms-flexbox;display:flex;color:#fff}.SiteFooter-donation{-webkit-flex:1;-ms-flex:1;flex:1}.SiteFooter-links{text-align:center;margin:0;padding:0;list-style:none}.SiteFooter-links li{display:inline-block;vertical-align:middle;margin:3px}.SiteFooter-links a{display:inline-block}.SiteFooter-icon{width:30px}.SiteFooter-icon:active,.SiteFooter-icon:focus,.SiteFooter-icon:hover{opacity:.5}.SiteFooter-button{display:inline-block;padding:.8em 1.2em;background:#333;color:#ccc;border-radius:3px;text-decoration:none;text-shadow:1px 1px 3px rgba(0,0,0,.5)}.SiteFooter-button:active,.SiteFooter-button:focus,.SiteFooter-button:hover{background:#555}.SiteFooter-button--light{background:#5aadbb;color:#fff}.SiteFooter-button--light:active,.SiteFooter-button--light:focus,.SiteFooter-button--light:hover{background:#3398a9}@media (max-width:800px){.SiteFooter{display:block}}@media (max-width:500px){.SiteFooter-links .mobile-ln{display:block}}.Donation{display:block;position:relative;padding-left:160px}.Donation-sticker{position:absolute;left:0;top:-100px}.Donation-text{position:relative;z-index:1}.Donation-text a{color:#fff;text-decoration:none}@media (max-width:850px){.Donation{text-align:center;margin-bottom:20px;padding-left:0}.Donation-sticker-clipping{position:absolute;left:-20px;right:-20px;bottom:-20px;top:-100px;overflow:hidden}.Donation-sticker{left:50%;margin-left:-250px;top:0}}.pln{color:#ccc}@media screen{.str{color:#00d300}.kwd{color:#61c4f2}.com{color:#888}.typ{color:#c0f}.lit{color:#00d300}.clo,.opn,.pun{color:#ccc}.tag{color:#ec131b}.atn{color:#ccc}.atv{color:#ffc20e}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:700}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:700}.lit{color:#044}.clo,.opn,.pun{color:#440}.tag{color:#006;font-weight:700}.atn{color:#404}.atv{color:#060}}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L4,li.L5,li.L6,li.L7,li.L8{list-style-type:decimal}pre.prettyprint{font-size:13px;padding:2px;border:1px solid #ccc;background-color:#000;border-radius:5px;-moz-border-radius:5px;padding:8px 14px;margin:0 0 20px}/*# sourceMappingURL=bundle-5589.14302a035b.map*/ 
@SBoudrias
Copy link
Member

Feel free to send a PR. We really need better CSS, but someone needs to step up and take ownership.

Siddharth11 added a commit to Siddharth11/yeoman.github.io that referenced this issue Jun 9, 2016
Normalize.css updated to latest version. All Unqualified Attribute Selectors removed to improve performance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants