Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Web重构之道

w3cplus
December 16, 2015

 Web重构之道

重构是一个含“金”量低的职位,而重构之道是具有历史的一个话题,做为一名Web重构从业人员,思考许久,毕竟目前很多Web从业人员都还在从事这部分工作,也有不少人对自己的职业或者所从事的重构工作感到迷茫。借此机会与大家一起探讨重构在Web中的重要性与历史使命。

w3cplus

December 16, 2015
Tweet

More Decks by w3cplus

Other Decks in Technology

Transcript

  1. Web᯿຅ԏ᭲ <div class="media"> <div class="media__object"> <img src="" alt=""> </div> <div

    class="media__body"> ... </div> </div> .media { &:after{ content:""; display: table; clear:both; } &__object { float: left; } &__body { overflow: hidden; } }
  2. Web᯿຅ԏ᭲ <div class="media"> <div class="media__object pull-left"> <img src="" alt=""> </div>

    <div class="media__object pull-right"> <button type="button">...</button> </div> <div class="media__body"> ... </div> </div> .media { &:after{ content:""; display: table; clear:both; } &__object { float: left; &.pull-right{ float:right; } } &__body { overflow: hidden; } }
  3. Web᯿຅ԏ᭲ <div class="media shop"> <div class="media__object"> <img src="" alt=""> </div>

    <div class="media__body"> ... </div> </div> <div class="media card"> <div class="media__object"> <img src="" alt=""> </div> <div class="media__body"> ... </div> </div>
  4. Web᯿຅ԏ᭲ <div class="flag"> <div class="flag__item"> <img src="" alt=""> </div> <div

    class="flag__item"> ... </div> </div> .flag { display: table; width: 100%; &__item { display: table-cell; vertical-align: middle; &--top { vertical-align: top; } &--bottom { vertical-align: bottom; } } }
  5. Web᯿຅ԏ᭲ var media = doc.createElement('div'); media.className = ‘media'; media.innerHTML =

    '<a class="media__object" href="">' + '<img src="" alt="">' + '</a>' + '<div class=“media__body”>…</div>’; media.querySelector(‘.media__object’).href = media.link; media.querySelector(‘.media__object img').src = media.avatarImg; …
  6. Web᯿຅ԏ᭲ Before 0 4.5 9 13.5 18 2G 3G 4G

    WIFI 3.3 3.9 7.5 16.1 Fully Loaded Time avg.