SlideShare une entreprise Scribd logo
1  sur  13
The HTML <select> tag
On styling it and the challenge it presents
The W3C Specification says:

• The <select> element represents a
  control for selecting amongst a set of
  options.
                                                         HTML Code
• Children tags are the options
  represented by the tag <option>


• Attributes: autofocus, disabled, form,
  multiple, name, required, size


• Source: http://www.w3.org/wiki/HTML/
  Elements/select

   - (examples are shown using a Mac Operating System)
Firefox 10 Mac OS                 IE7 Windows XP




Chrome 17 Mac OS                  Firefox 10 Windows XP




                                  Chrome 17 Windows XP


 Raw Style
 This is how the <select> looks
                                  IE8 Windows 7
 like on different browsers and
 Operating Systems with no CSS
 styles applied.

                                  Firefox 10 Windows 7
  Chrome 17 Windows 7
Firefox 10 Mac OS       IE7 Windows XP                       Chrome 17 Windows XP




                                         Firefox 10 Windows XP              Fifefox 10 Windows 7


CSS Styling
Basic styling over the <select>
tag.

Things get messy and
                                         IE8 Windows 7                     Chrome 17 Windows 7
unpredictable

CSS:
Firefox 10 Mac OS   IE7 Windows XP          Chrome 17 Windows XP        Firefox 10 Windows XP




More CSS Styling                     IE8 Windows 7                 Firefox 10 Windows 7




Advanced styling over the
<style> and <option> tags



                                     Chrome 17 Windows 7
Firefox 10 Mac OS




Limitations                        IE7 Windows XP




The <select> arrow can’t be
styled and varies from browser-
to-browser and OS.


                                  Firefox 10 Windows 7
Firefox 10 Mac OS




                                  IE7 Windows XP


Limitations
Unfortunately, the mouse
hovered <option> color can’t be
styled. It is set by the OS.
                                  Chrome 17 Windows 7
Styled <span>

Alternatives                                         sitting on top of
                                                       <select> tag


De-facing

With JavaScript we can hide the
<select> tag and place a <span>
tag on top of it which can be freely
styled.                                                                         Default
                                                                                 HTML
                                                                              scrollbar for
The <option> tags conserve the                                                 <option>
default HTML behavior.                                                            tags




                                       <option> tags conserve HTML behavior
Firefox 10 Mac OS




Alternatives
Replace <option> tags.

With JavaScript we can replace
each <option> tag for another
                                                IE 7 Windows XP
HTML tag that allows proper
styling.

Source:
http://jquery-ui.googlecode.com/svn/branches/
labs/selectmenu/index.html
De-facing




                            <option>
                         replacement to
                                                                            Custom
A very styled            control hovered
                           style color
                                                                           scroll-bar
                                                                         replacement
<select> menu
De-facing

<option> replacement

Scroll-bar replacement



                                           Semi-transparent background
The price of the alternatives (technical & long)

• All the JavaScript alternatives put work-load on the browser.

• JavaScript works with the code delivered from BackEnd: <select> and <option> tags.

  De-facing:                                       <option> replacement:

• Each <select> tag is hidden.                   • Each <select> tag is replaced with
                                                   1 <a> tag and 2 <span> tags.
• A <span> tag is introduced.
                                                 • 5 JS events are attached to the
• Both get wrapped in a <div>                      <a> tag.
  element.
                                                 • Each <option> tag is replaced
  Scroll-bar replacement:                          with a <li> & <a> tag and wrapped
                                                   in a <ul> tag.
• 4 <div> elements created to mock
  a styled scroll-bar.                           • 6 JS events are attached to each
                                                   <li> tag to emulate the HTML
• 4 JS events are attached to each                 behavior of the <select> &
  <select> menu.                                   <option> tags.
A test case - www.moneygram.com
• There are 5 <select> tags and 569 <option> tags on page-load.

• Some <select> tags get populated by AJAX calls after page-load, increasing the number of
  <option> tags.


  Costs for the browser:

• 594 HTML tag replacements.

• 3.459 JavaScript event attachments.

• Each time an AJAX call is made, new <option> tags come - HTML tag
  replacements and event attachments must be made on-the-spot.

• Our tests show that this process alone consumes 23% of the browsers available
  memory against 2% for the un-styled HTML approach.

• This is 11.5 times as intensive. Too much!
Analysis

• The a site like www.moneygram.com has too many <option> tags (500+)
  because most of them are part of a country selection list with 180+ countries.


• We don’t recommend using the <option> JavaScript replacement option as it
  consumes almost 1/4 of the browser’s memory.


• Users are already familiar with the default HTML behavior for <select> menus
  on different browsers and Operating Systems.


• The de-facing alternative offers a good styling option for the un-dropped
  <select> menu and it’s not so intensive for the browser.

Contenu connexe

Similaire à The HTML select tag styling challenge

Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Brian Moon
 
Bootstrap and XPages (DanNotes 2013)
Bootstrap and XPages (DanNotes 2013)Bootstrap and XPages (DanNotes 2013)
Bootstrap and XPages (DanNotes 2013)Mark Leusink
 
What's New for AJAX Developers in IE8 Beta1?
What's New for AJAX Developers in IE8 Beta1?What's New for AJAX Developers in IE8 Beta1?
What's New for AJAX Developers in IE8 Beta1?Janakiram MSV
 
Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...
Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...
Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...camp_drupal_ua
 
Windows 8 Pure Imagination - 2012-11-24 - Getting your HTML5 game Windows 8 r...
Windows 8 Pure Imagination - 2012-11-24 - Getting your HTML5 game Windows 8 r...Windows 8 Pure Imagination - 2012-11-24 - Getting your HTML5 game Windows 8 r...
Windows 8 Pure Imagination - 2012-11-24 - Getting your HTML5 game Windows 8 r...Frédéric Harper
 
Flyweight jquery select_presentation
Flyweight jquery select_presentationFlyweight jquery select_presentation
Flyweight jquery select_presentationRay Brooks
 
DevTeach Montreal - 2012-12-11 - Windows 8 & HTML5: friends with benefits
DevTeach Montreal - 2012-12-11 - Windows 8 & HTML5: friends with benefitsDevTeach Montreal - 2012-12-11 - Windows 8 & HTML5: friends with benefits
DevTeach Montreal - 2012-12-11 - Windows 8 & HTML5: friends with benefitsFrédéric Harper
 
jQuery Tips Tricks Trivia
jQuery Tips Tricks TriviajQuery Tips Tricks Trivia
jQuery Tips Tricks TriviaCognizant
 
Internet Explorer 8
Internet Explorer 8Internet Explorer 8
Internet Explorer 8David Chou
 
Developing web applications in 2010
Developing web applications in 2010Developing web applications in 2010
Developing web applications in 2010Ignacio Coloma
 
Modern Web Development
Modern Web DevelopmentModern Web Development
Modern Web DevelopmentRobert Nyman
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web ApplicationYakov Fain
 
SPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery EssentialsSPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery EssentialsMark Rackley
 

Similaire à The HTML select tag styling challenge (20)

Html5/CSS3
Html5/CSS3Html5/CSS3
Html5/CSS3
 
Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Ease into HTML5 and CSS3
Ease into HTML5 and CSS3
 
Bootstrap and XPages (DanNotes 2013)
Bootstrap and XPages (DanNotes 2013)Bootstrap and XPages (DanNotes 2013)
Bootstrap and XPages (DanNotes 2013)
 
What's New for AJAX Developers in IE8 Beta1?
What's New for AJAX Developers in IE8 Beta1?What's New for AJAX Developers in IE8 Beta1?
What's New for AJAX Developers in IE8 Beta1?
 
Push it to the Edge
Push it to the EdgePush it to the Edge
Push it to the Edge
 
Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...
Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...
Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...
 
Echo HTML5
Echo HTML5Echo HTML5
Echo HTML5
 
Html.ppt
Html.pptHtml.ppt
Html.ppt
 
Windows 8 Pure Imagination - 2012-11-24 - Getting your HTML5 game Windows 8 r...
Windows 8 Pure Imagination - 2012-11-24 - Getting your HTML5 game Windows 8 r...Windows 8 Pure Imagination - 2012-11-24 - Getting your HTML5 game Windows 8 r...
Windows 8 Pure Imagination - 2012-11-24 - Getting your HTML5 game Windows 8 r...
 
Flyweight jquery select_presentation
Flyweight jquery select_presentationFlyweight jquery select_presentation
Flyweight jquery select_presentation
 
DevTeach Montreal - 2012-12-11 - Windows 8 & HTML5: friends with benefits
DevTeach Montreal - 2012-12-11 - Windows 8 & HTML5: friends with benefitsDevTeach Montreal - 2012-12-11 - Windows 8 & HTML5: friends with benefits
DevTeach Montreal - 2012-12-11 - Windows 8 & HTML5: friends with benefits
 
jQuery Tips Tricks Trivia
jQuery Tips Tricks TriviajQuery Tips Tricks Trivia
jQuery Tips Tricks Trivia
 
Jsf2 html5-jazoon
Jsf2 html5-jazoonJsf2 html5-jazoon
Jsf2 html5-jazoon
 
Edge of the Web
Edge of the WebEdge of the Web
Edge of the Web
 
Internet Explorer 8
Internet Explorer 8Internet Explorer 8
Internet Explorer 8
 
Developing web applications in 2010
Developing web applications in 2010Developing web applications in 2010
Developing web applications in 2010
 
Lit there be light
Lit there be lightLit there be light
Lit there be light
 
Modern Web Development
Modern Web DevelopmentModern Web Development
Modern Web Development
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
 
SPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery EssentialsSPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery Essentials
 

Dernier

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 

Dernier (20)

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 

The HTML select tag styling challenge

  • 1. The HTML <select> tag On styling it and the challenge it presents
  • 2. The W3C Specification says: • The <select> element represents a control for selecting amongst a set of options. HTML Code • Children tags are the options represented by the tag <option> • Attributes: autofocus, disabled, form, multiple, name, required, size • Source: http://www.w3.org/wiki/HTML/ Elements/select - (examples are shown using a Mac Operating System)
  • 3. Firefox 10 Mac OS IE7 Windows XP Chrome 17 Mac OS Firefox 10 Windows XP Chrome 17 Windows XP Raw Style This is how the <select> looks IE8 Windows 7 like on different browsers and Operating Systems with no CSS styles applied. Firefox 10 Windows 7 Chrome 17 Windows 7
  • 4. Firefox 10 Mac OS IE7 Windows XP Chrome 17 Windows XP Firefox 10 Windows XP Fifefox 10 Windows 7 CSS Styling Basic styling over the <select> tag. Things get messy and IE8 Windows 7 Chrome 17 Windows 7 unpredictable CSS:
  • 5. Firefox 10 Mac OS IE7 Windows XP Chrome 17 Windows XP Firefox 10 Windows XP More CSS Styling IE8 Windows 7 Firefox 10 Windows 7 Advanced styling over the <style> and <option> tags Chrome 17 Windows 7
  • 6. Firefox 10 Mac OS Limitations IE7 Windows XP The <select> arrow can’t be styled and varies from browser- to-browser and OS. Firefox 10 Windows 7
  • 7. Firefox 10 Mac OS IE7 Windows XP Limitations Unfortunately, the mouse hovered <option> color can’t be styled. It is set by the OS. Chrome 17 Windows 7
  • 8. Styled <span> Alternatives sitting on top of <select> tag De-facing With JavaScript we can hide the <select> tag and place a <span> tag on top of it which can be freely styled. Default HTML scrollbar for The <option> tags conserve the <option> default HTML behavior. tags <option> tags conserve HTML behavior
  • 9. Firefox 10 Mac OS Alternatives Replace <option> tags. With JavaScript we can replace each <option> tag for another IE 7 Windows XP HTML tag that allows proper styling. Source: http://jquery-ui.googlecode.com/svn/branches/ labs/selectmenu/index.html
  • 10. De-facing <option> replacement to Custom A very styled control hovered style color scroll-bar replacement <select> menu De-facing <option> replacement Scroll-bar replacement Semi-transparent background
  • 11. The price of the alternatives (technical & long) • All the JavaScript alternatives put work-load on the browser. • JavaScript works with the code delivered from BackEnd: <select> and <option> tags. De-facing: <option> replacement: • Each <select> tag is hidden. • Each <select> tag is replaced with 1 <a> tag and 2 <span> tags. • A <span> tag is introduced. • 5 JS events are attached to the • Both get wrapped in a <div> <a> tag. element. • Each <option> tag is replaced Scroll-bar replacement: with a <li> & <a> tag and wrapped in a <ul> tag. • 4 <div> elements created to mock a styled scroll-bar. • 6 JS events are attached to each <li> tag to emulate the HTML • 4 JS events are attached to each behavior of the <select> & <select> menu. <option> tags.
  • 12. A test case - www.moneygram.com • There are 5 <select> tags and 569 <option> tags on page-load. • Some <select> tags get populated by AJAX calls after page-load, increasing the number of <option> tags. Costs for the browser: • 594 HTML tag replacements. • 3.459 JavaScript event attachments. • Each time an AJAX call is made, new <option> tags come - HTML tag replacements and event attachments must be made on-the-spot. • Our tests show that this process alone consumes 23% of the browsers available memory against 2% for the un-styled HTML approach. • This is 11.5 times as intensive. Too much!
  • 13. Analysis • The a site like www.moneygram.com has too many <option> tags (500+) because most of them are part of a country selection list with 180+ countries. • We don’t recommend using the <option> JavaScript replacement option as it consumes almost 1/4 of the browser’s memory. • Users are already familiar with the default HTML behavior for <select> menus on different browsers and Operating Systems. • The de-facing alternative offers a good styling option for the un-dropped <select> menu and it’s not so intensive for the browser.

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n