3. Getting started with html
- HTML is a
mark-up language
- Anatomy of a HTML element:
3. GETTING STARTED WITH HTML
- HTML is a mark-up language
- Anatomy of an HTML element:
3. GETTING STARTED WITH HTML
- HTML is a mark-up language
- Anatomy of an HTML element:
3. GETTING STARTED WITH HTML
- HTML is a mark-up language
- Anatomy of a HTML element:
3. GETTING STARTED WITH HTML
- HTML is a mark-up language
- Anatomy of a HTML element:
3. GETTING STARTED WITH HTML
- HTML document:
- Text file
- .html (convention)
- Anatomy of an HTML document (outer structure):
3. GETTING STARTED WITH HTML
- HTML document:
- Text file
- .html (convention)
- Anatomy of an HTML document (metadata):
3. GETTING STARTED WITH HTML
- HTML document:
- Text file
- .html (convention)
- Anatomy of an HTML document (content):
3. GETTING STARTED WITH HTML
3. GETTING STARTED WITH HTML
- HTML entities:
- Allow using reserved characters in texts
- Formatting:
3. GETTING STARTED WITH HTML
- Global attributes:
-
accesskey
:
- Keyboard shortcut to select elements on the page
3. GETTING STARTED WITH HTML
- Global attributes:
-
class :
- Categorize elements
- Multiple classes
- Does nothing per se
3. GETTING STARTED WITH HTML
- Global attributes:
-
contenteditable :
- Let the visitor change the content of the page
- Values: "true" or "false"
- No value: inherits it from parent
3. GETTING STARTED WITH HTML
- Global attributes:
-
contextmenu :
- The menu pops up when the user triggers it
- Supported by Firefox
3. GETTING STARTED WITH HTML
3. GETTING STARTED WITH HTML
- Global attributes:
-
draggable
:
- Specifies if an element is draggable or not
3. GETTING STARTED WITH HTML
- Global attributes:
-
dropzone
:
- Specifies whether the dragged data is copied, moved or linked, when it is dropped on the element
- Not currently supported by any of the major browsers
3. GETTING STARTED WITH HTML
- Global attributes:
-
hidden
:
- The element is not yet, or is no longer, relevant
- The element should not be shown
- Space not reserved
3. GETTING STARTED WITH HTML
- Global attributes:
-
id
:
- Assigns a unique identifier to the element
- Must be unique within the HTML document
- Navigation to the element via #id
3. GETTING STARTED WITH HTML
- Global attributes:
-
lang
:
- Specifies the language of the element's content
- Must be a valid ISO value
- Let the browser adjust the display of the content
3. GETTING STARTED WITH HTML
- Global attributes:
-
spellcheck
:
- Specifies if the browser should check the spelling of the element's content
3. GETTING STARTED WITH HTML
- Global attributes:
-
style
:
- Allows to define CSS styles directly on an element
3. GETTING STARTED WITH HTML
- Global attributes:
-
tabindex
:
- Order in which the Tab key moves the focus through the elements
3. GETTING STARTED WITH HTML
- Global attributes:
-
title
:
- Provides additional information about an element
- Commonly used to show tool tip information
4. getting started with Javascript
- A little bit of history:
-
1995: Brendan Eich: Mocha → LiveScript, for Netscape 2
-
1997:
- JavaScript 1.1 submitted to the ECMA (ECMA-262 → ECMAScript)
- JavaScript = ECMAScript (core) + Extensions (DOM, BOM, etc.)
-
1998: ISO standard: ISO/IEC 16262
-
1998 - 2008: Browsers war (version support, JScript, etc.)
-
2009 - ... : Programming language of the Web (stable support in browsers)
4. getting started with Javascript
-
Case sensitive
- Including scripts in an HTML document (inline script):
4. getting started with Javascript
-
Case sensitive
- Including scripts in an HTML document (external script):
4. getting started with Javascript
-
Strict mode:
- Introduced in ECMAScript 5
- Different parsing and execution model for JavaScript
- Erratic behavior of ECMAScript 3 is addressed
- Errors are thrown for unsafe activities
- Distinct set of reserved words (more restrictive)
4. getting started with Javascript
- Variables and Types:
- Javascript is a loosely typed language:
- Assigning different types to the same variable
4. getting started with Javascript
- Types:
- Primitive types:
Boolean
,
Number
, Null,
String
, Undefined
4. getting started with Javascript
- Types:
- Primitive types: Boolean, Number,
Null
, String,
Undefined
4. getting started with Javascript
- Objects:
- Object instantiation (new keyword)
- Adding properties
- Deleting properties
4. getting started with Javascript
4. getting started with Javascript
- Objects:
- Built-in properties and methods (most common)
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
-
Numbers:
- Built-in properties and methods (most common)
4. getting started with Javascript
-
Strings:
- Strings are immutable in ECMAScript
4. getting started with Javascript
4. getting started with Javascript
-
Strings:
- Built-in properties and methods (most common)
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
-
Arrays:
- Built-in properties and methods (most common)
4. getting started with Javascript
- Functions:
- Declaration and invocation
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
- Math object:
- Global object just as Global (aka. window in browsers)
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
- Operators (most useful):
- Comparison operators
- Primitives types are compared by value
- Objects are compared by reference
4. getting started with Javascript
- Operators (most useful):
- Concatenation operator (precedence over the arithmetic one)
4. getting started with Javascript
- Operators (most useful):
- Conditional operator (ternary)
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
4. getting started with Javascript
- Scopes:
- global scope
- function scope
-
with
statement
-
catch block
- Garbage collection (mark-and-sweep)
4. getting started with Javascript
4. getting started with Javascript
- Object Oriented Programming (OOP):
4. getting started with Javascript
5. HTML elements in-depth
- The most important change in HTML5 is a philosophical one:
- Semantics of elements vs. presentation
- Ex.: <b> no longer states text in bold (backwards compatibility, preferably avoid them using CSS)
"The b element represents a span of text to which attention is being drawn for utilitarian purposes without conveying any extra importance and with no implication of an alternate voice or mood, such as key words in a document abstract, product names in a review, actionable words in interactive text-driven software, or an article lede."
5. HTML elements in-depth
- Some preliminary recommendations:
- Add only the needed markup to give semantic significance to your content
- Avoid using private semantics (use generic elements instead: <div>, <span>) and/or classes
- Be as specific as possible (don't abuse of generic elements)
- It's not all about presentation (programatic access to HTML content, adapted presentation, etc.)
5. HTML elements in-depth
5. HTML elements in-depth
- Document and metadata elements:
- Create the superstructure of the HTML document
- Provide information to the browser
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
- Text-level elements:
- Input and output elements
5. HTML elements in-depth
- Text-level elements:
- Abbreviations, citations, definitions and quotations
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
- Embedding content using plugins:
5. HTML elements in-depth
- Embedding content using plugins:
5. HTML elements in-depth
5. HTML elements in-depth
5. HTML elements in-depth
- Embedding numeric representations:
5. CSS styling in-depth
-
Media queries:
-
Limits the style sheets' scope by using media features, such as width, height, and color
- Separated by commas
- Composed of:
- Logical operators
- Media types
- Media expressions: feature and value
6. JAVASCRIPT IN DEPTH
- Javascript is much more than ECMA-262 (not tied to browsers)
- Extensions:
- Additional functionality more specific to the environment
-
Browser Object Model (BOM):
- API to interact with the browser
-
Document Object Model (DOM):
- API to interact with an HTML document
- Levels (versions of the spec.)
- Distinct support by browsers
- Other DOMs: SVG, MathML, SMIL, Mozilla's XUL
6. Javascript in-depth
-
document metadata properties:
6. Javascript in-depth
-
document location properties:
6. Javascript in-depth
-
Accessing HTML elements via document's properties:
6. Javascript in-depth
-
Searching for HTML elements:
6. Javascript in-depth
-
Getting information about the window:
6. Javascript in-depth
-
Interacting with the window:
6. Javascript in-depth
-
Cross-document messaging (sender):
6. Javascript in-depth
-
Cross-document messaging (listener):
6. Javascript in-depth
- Working with DOM elements:
6. Javascript in-depth
- Working with DOM elements:
6. Javascript in-depth
- Working with DOM elements:
- Element attribute properties:
6. Javascript in-depth
- Working with Text elements:
6. Javascript in-depth
- Modifying the model:
- Basic functions and properties:
6. Javascript in-depth
- Styling DOM elements:
- Working with stylesheets:
6. Javascript in-depth
- Working with events:
- An event is a change in the state of something
- Element event flow:
- Capture:
-
Checks if elements between the <body> and the target have event listeners which asked to be notified of events of their descendants. Disabled by default
- Target:
- Checks the target added events listeners
- Bubbling:
- Checks the ascendants added events listeners
6. Javascript in-depth
- Working with events:
- Using the DOM and the Event object:
6. Javascript in-depth
- Working with events:
- Document and Window events:
6. Javascript in-depth
- Using element specific objects:
- base element (HTMLBaseElement):
6. Javascript in-depth
- Using element specific objects:
- body element (HTMLBodyElement):
6. Javascript in-depth
- Using element specific objects:
- link element (HTMLLinkElement):
6. Javascript in-depth
- Using element specific objects:
- meta element (HTMLMetaElement):