style validator at breakout session of tpac2015

26
Style Validator CSS Validation in the Browser Igari Takeharu TPAC2015 in Sapporo

Upload: takeharu-igari

Post on 14-Apr-2017

6.140 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Style Validator at breakout session of TPAC2015

Style ValidatorCSS Validation in the Browser

Igari Takeharu

TPAC2015 in Sapporo

Page 2: Style Validator at breakout session of TPAC2015

Takeharu Igari

• Front-end Engineer (8years of carrier)

• Evangelist

• General Manager in Vanguard Development Division

I’m sorry that I can not listening english well

Page 3: Style Validator at breakout session of TPAC2015

What’re the problems of current CSS Validation

Page 4: Style Validator at breakout session of TPAC2015

Three problems of current CSS Validator

• Can’t validate content that is modified by JavaScript

• Can’t validate computed styles

• Can’t validate matching of style and style for each HTML Tag

So, valid CSS is too complicated.

Page 5: Style Validator at breakout session of TPAC2015
Page 6: Style Validator at breakout session of TPAC2015
Page 7: Style Validator at breakout session of TPAC2015

What’re invalid styles?

Page 8: Style Validator at breakout session of TPAC2015

Case1-1: Needless Styles• Q. What is value of display property of DIV element?

In this case, display: inline; is needless style

A. block

Page 9: Style Validator at breakout session of TPAC2015

Case1-2: Needless Styles• Q. What is value of display property of P element?

A. block

In this case, display: inline; is needless style

Page 10: Style Validator at breakout session of TPAC2015

Case1-3: Needless Styles• Q. What is value of width property of span element?

A. auto

In this case, width has to be removed or span has to be block

Page 11: Style Validator at breakout session of TPAC2015

• Q. Pseudo element into empty element is OK?

• Correct one

Case2-1: Risky Styles

A.No. this is Buggy.

Page 12: Style Validator at breakout session of TPAC2015

Case2-2: Risky Styles• Q. No parent table-cell is OK?

A.No. this is Buggy• Here is correct one.

Page 13: Style Validator at breakout session of TPAC2015

• No parent table-cell in Media Query

• Correct one

Case3-1: Mistake in Media Query

No parent table-cell…

Page 14: Style Validator at breakout session of TPAC2015

• Before JavaScript

Case3−2: Mistake after Javascript

Page 15: Style Validator at breakout session of TPAC2015

• After inserting DOM by JavaScript

Case3−2: Mistake after Javascript

display inline in table…

Page 16: Style Validator at breakout session of TPAC2015

Invalid styles give you…

• Meaningless patch

• Interrupting creative ideas

• Loss of valuable engineer’s life

Page 17: Style Validator at breakout session of TPAC2015

Solution

Page 18: Style Validator at breakout session of TPAC2015

Style Validator• Validation of computed style

• Validation of matching of style and style

• Validation of while tracking DOM modification.(e.g. after modifying DOM by JavaScript)

Page 19: Style Validator at breakout session of TPAC2015

Demonstration

Page 20: Style Validator at breakout session of TPAC2015

Introduction Page

Page 21: Style Validator at breakout session of TPAC2015

Demo Page

Page 22: Style Validator at breakout session of TPAC2015

Week point

• By non-official specifications

• It is depend on work field engineer’s knowledge.

Page 23: Style Validator at breakout session of TPAC2015

Anybody can edit rules

Page 24: Style Validator at breakout session of TPAC2015

Next is ….

Page 25: Style Validator at breakout session of TPAC2015

Open Source Project

• This will be a open source project soon.

• So, Please join as a Contributor

• Finally, I wish that the Style Validator helps work field engineer & CSS & Web.

Page 26: Style Validator at breakout session of TPAC2015

Thanks for your patient!

• Please feel free to contact me [email protected] https://www.facebook.com/IgariTakeharu

• Official Websitehttp://style-validator.github.io/

• Githubhttps://github.com/Style-Validator/