Refactoring HTML Elliotte Rusty Harold

Slides:



Advertisements
Similar presentations
XHTML Week Two Web Design. 2 What is XHTML? XHTML is the current standard for HTML Newest generation of HTML (post-HTML 4) but has many new features which.
Advertisements

HTML: HyperText Markup Language Hello World Welcome to the world!
1 HTML Standards & Compliance. 2 Minimum Required HTML tags: (must go in this order!)
History Leading to XHTML
Beginning Web Site Creation: Dreamweaver CS4 Noreen Brown XHTML CODING -- TAGS.
XHTML 16-Apr-17.
XHTML. XHTML is one of the many XML-based languages that have been defined XHTML is, essentially, a “cleaned-up” version of HTML 4, reformulated using.
17-Jun-15 XHTML 2 What is XHTML? XHTML stands for Extensible Hypertext Markup Language XHTML is aimed to replace HTML.
Creating a Well-Formed Valid Document. 2 Objectives Introducing XHTML Creating a Well-Formed Document Creating a Valid Document Creating an XHTML Document.
F DIGITAL MEDIA: COMMUNICATION AND DESIGN INTRODUCTION TO XML AND XHTML.
Creating and Editing a Web Page
HTML & CSS A brief introduction. OUTLINE 1.What is HTML? 2.What is CSS? 3.How are they used together? 4.Troubleshooting/Common problems 5.More resources.
Building the User Interface by Using HTML5: Organization, Input, and Validation Lesson 3.
Working with XHTML Creating a Well-Formed Valid Document.
XP Tutorial 9New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
 XHTML is aimed to replace HTML  XHTML is almost identical to HTML 4.01  XHTML is a stricter and cleaner version of HTML  XHTML is HTML defined as.
XHTML The Basics A brief history of HTML SGML (Standard Generalized Markup Language) Then came HTML Followed by the browser…and the great browser wars.
HTML history, Tags, Element. HTML: HyperText Markup Language Hello World Welcome to the world!
Chapter 1 XHTML: Part I The Web Warrior Guide to Web Design Technologies.
Web page - A Web page is a simple text file that contains a set of HTML tags (code) that describe (to the browser) what should go on a web page. It may.
XHTML Instructor: Charles Moen CSCI/CINF XHTML  A stricter version of HTML  Extensible HTML  The XHTML specification is maintained by the World.
Objectives: 1. Create a Skeleton HTML 2. View a Skeleton File Through a Server and Browser 3. Learn HTML Body Tags for the Display of Text and Graphics.
XHTML Presented by Kelly(Geun-young) Yim. Learning Objectives  List the difference between XHTML and HTML  Create a valid, well-formed XHTML document.
3 XHTML.
Extensible HyperText Markup Language (XHTML) Laboratory of Intelligent Youn-Hee Han.
1 HTML XHTML. 2 Understand the Doctype tag Know the html tags which are now classed as depreciated Understand how Dreamweaver adds styles Add styles to.
Website Development & Management Creating Web Pages CIT Fall Instructor: John Seydel, Ph.D.
Interfaces, Browsers & Browsing Primary Readings - Designing With Web Standards: Chapters Designing With Web Standards Class Work - Big IA vs. little.
1 XHTML محمد احمدی نیا 2 Of 19 HTML vs XHTML  XHTML is a stricter and cleaner version of HTML.  by combining the strengths of HTML.
>> Introduction to HTML: Tags. Hyper - is the opposite of linear Text – words / sentences / paragraphs Mark-up – Marking the text Language – It is a language.
XHTML. Introduction to XHTML What Is XHTML? – XHTML stands for EXtensible HyperText Markup Language – XHTML is almost identical to HTML 4.01 – XHTML is.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorial 9: Working With XHTML.
XP Dreamweaver 8.0 Tutorial 3 1 Adding Text and Formatting Text with CSS Styles.
XP Tutorial 9 1 Working with XHTML. XP SGML 2 Standard Generalized Markup Language (SGML) A standard for specifying markup languages. Large, complex standard.
Lesson 4.
Copyright © Osmosys O S M O S Y SO S M O S Y S D e p l o y i n g E x p e r i e n c e & E x p e r t i s e™ HTML Training.
Web Development & Design Foundations with XHTML Chapter 2 HTML/XHTML Basics.
Daveandal.net Cascading Style Sheets 101 “How I learnt to love CSS and found my inner designer”
Lecture: Web Design Assis. Prof. Freshta Hanif Ehsan Faculty of Computer Science Kabul Polytechnic University Spring Semester
Birkbeck University of London Business Workshop Web Accessibility for small businesses How to convert table layout page to css.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
Copyright © 2003 Pearson Education, Inc. Slide 1-1 Created by Cheryl M. Hughes The Web Wizard’s Guide to XHTML by Cheryl M. Hughes.
©SoftMoore ConsultingSlide 1 Introduction to HTML: Basic Document Structure.
HTML A brief introduction HTML1. HTML, what is? HTML is a markup language for describing web documents (web pages). HTML stands for Hyper Text Markup.
Information Architecture 2 Primary Readings - Designing With Web Standards: Chapters 5-8 Designing With Web Standards Deliverables - Design Critiques due.
THE TEXT ELEMENTS. THE HEADING ELEMENTS,,,, and - introduce new section of content as a title or a header. Heading sizes range from H1 to H6, where H1.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
CIS 228 The Internet 9/20/11 XHTML 1.0. “Quirks” Mode Today, all browsers support standards Compliant pages are displayed similarly There are multiple.
INT222 – Internet Fundamentals
XHTML Basics. What is XHTML? XHTML is newer than, but built upon, the original HTML (Hyper Text Markup Language) platform. XHTML has stricter rules and.
Information Architecture 2 No Class Scheduled October 23 Primary Readings - Zeldman, J. (2003). Designing With Web Standards: Chapters 6-8Designing With.
Extensible Markup Language (XML) Pat Morin COMP 2405.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
What is XHTML? XHTML stands for Extensible Hypertext Markup Language
HTML CS 4640 Programming Languages for Web Applications
CIS 228 The Internet 9/20/11 XHTML 1.0.
Validation.
Creating a Well-Formed Valid Document
CITA 330 Section 3 XHTML.
Web Development & Design Foundations with HTML5 8th Edition
Validation.
XHTML
HTML A brief introduction HTML.
XHTML 7-May-19.
Dreamweaver.
XHTML 29-May-19.
محمد احمدی نیا XHTML محمد احمدی نیا
HTML CS 4640 Programming Languages for Web Applications
Creating Web Documents
Presentation transcript:

Refactoring HTML Elliotte Rusty Harold

Why Refactor

What to Refactor To XHTML CSS REST

Move Away From Tag soup Presentation based markup Stateful applications

XHTML

CSS

REST All resources are identified by URLs. Safe, side-effect free operations such as querying or browsing operate via GET. Non-safe operations operate via POST. Each request is independent of all others.

Tools

The Refactoring Process 1. Identify the problem. 2. Fix the problem. 3. Verify that the problem has been fixed 4. Check that no new problems have been introduced. 5. Deploy the solution.

Things Can Go Wrong Backups Staging Servers Source Code Control

Validators W3C Markup Validation Service LogValidator Xmllint Editors: DreamWeaver, BBEdit, etc.

Testing HTMLUnit JsUnit HTTPUnit jWebUnit Fitnesse Selenium

Regular Expressions Learn them! But be cautious Prefer parser-based solutions

Tidy C (and PHP) Custom API Can handle most bad markup Usually produces well-formed XHTML Often produces valid XHTML $ tidy -asxhtml -m index.html

TagSoup Java and SAX Can Handle Anything Always well-formed May not be valid $ java -jar tagsoup.jar -- encoding=ISO index.html

Well-formedness Defined Every element has one parent elemnet; no overlap Every start-tag has a case-sensitive matching end-tag Attribute values are quoted Entity references are defined +Namespaces

Well-formedness Refactorings Make name lower case Quote attribute value Replace empty tag with empty-element tag Add end-tag Eliminate overlap Convert text to UTF-8 Escape < and & Introduce an XHTML DOCTYPE Introduce the XHTML namespace

Validity Defined The document has a DOCTYPE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "/dtds/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" " The document adheres to constraints expressed in the DTD Nothing that’s not in the DTD Not as important as well-formedness

Validity Defined The document has a DOCTYPE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "/dtds/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" " Document adheres to constraints expressed in the DTD

Validity Refactorings Introduce Transitional DOCTYPE Introduce Strict DOCTYPE

Transitional Eliminate bogons Add alt attributes

Srict Replace center, b, i, font, etc. with CSS Nest inline elements in block elements

Layout Wrap related information in divs Add ID attributes Replace table layouts with CSS Replace frames with CSS positions Put the content first Markup lists as lists Replace blockquote/ul indentation with CSS Replace spacer GIFs

Accessibility Convert images to text Add labels to forms Standard names for input fields Add tab indexes to forms Add skip navigation Add internal headings Provide captions, summaries, and headers for tables Identify acronyms

Web Applications Replace GET with POST Replace POST with GET Replace Flash with HTML Make web apps cache savvy Provide Etags Add Web Forms 2.0 Types Block robots Avoid SQL injection

Content Check spelling Check links Restructure sites but keep the URLs Remove entry pages Hide addresses from spambots

Objections To Refactoring We don’t have the time to waste on cleaning up the code. We have to get this feature implemented now! Refactoring saves time in the long run. You have more time than you think you do.

Further Reading Refactoring HTML: Elliotte Rusty Harold Refactoring: Martin Fowler Designing with Web Standards:Jeffrey Zeldman The Zen of CSS Design: Dave Shea & Molly Holzchlag