H5 basic knowledge

SVG

SVG is a 2D graphics using XML description language.
Canvas to draw 2D graphics using JavaScript.

Canvas
rely resolution
does not support event handlers
text rendering capabilities weak
can save the resulting image to .png or .jpg format
most suitable for graphics-intensive games, many objects are frequently redrawn

SVG
does not depend on the resolution of
support incidents processor
best suited to applications with a large rendering areas (such as Google Maps)
high complexity can slow down rendering speed (excessive use of any application is not fast DOM)
is not suitable for gaming applications

What is SVG?
Refers to a Scalable Vector Graphics SVG (the Scalable the Vector Graphics)
SVG graphic vectors defined based on a network
using a defined XML format graphic SVG
SVG image without changing the size of which is enlarged or no loss graphic quality
SVG is a World Wide Web Consortium the standard
SVG advantages
and compared to other image formats (such as JPEG and GIF), the advantages of using SVG is that:

SVG images can be created and modified using a text editor,
SVG images can be searched, indexed, scripted or compressed
SVG is scalable
SVG images can be printed in high quality at any resolution
SVG may not decrease in image quality It is amplified in the case

Get the user's location

the getCurrentPosition () method to get the user's location.

Error code:
Permission denied - user is not allowed geopositioning
Position unavailable - Can not get the current location
Timeout - The operation timed out

coords.latitude decimal latitude
and longitude coords.longitude decimal
coords.accuracy positional accuracy
coords.altitude altitude above sea level in meters
above sea level position accuracy coords.altitudeAccuracy
coords.heading direction, in degrees from True North start
coords .speed speed, in meters / sec basis
date timestamp response / time

MIME type of audio format of
the Format of the type-MIME
MP3 Audio / mpeg
Ogg Audio / OGG
Wav Audio / WAV

HTML5 Audio tag
label describes
the definition of the sound content

Provides multimedia resources, it can be more, for use in the label

Web SQL Database API is not part of the HTML5 spec, but it is a separate specification, introduced a set of APIs to use SQL operation client database.

Core methods
The following methods are the core defined in the specification:
openDatabase: This method uses an existing database to create a new database or database object.
transaction: This method allows us to control a transaction, and based on this case commit or rollback.
executeSql: This method is used to perform the actual SQL query.

Application Cache

Application cache application brings three advantages:
Offline browsing - users can use when they are off-line applications
Speed - cached resources load faster and
reduce server load - the browser will only download updated or changed resources from the server.

The manifest file can be divided into three parts:
manifest file is a simple text file that tells the browser to cache content (and does not cache content).
CACHE MANIFEST - in the heading of this document will take place after the first download cache
NETWORK - In the heading of the document needs to be connected to the server, and will not be cached
FALLBACK - in the heading of this document can not be specified when the page fallback page (such as page 404) when accessing

Update the cache
once the application is cached, it will remain cached until the following occurs:
you clear your browser cache
manifest file is modified (see tips below)
to update the program by the application cache

web worker

What is a Web Worker?
When executing the script in the HTML page, the page state is unresponsive until the script is complete.

web worker is a JavaScript running in the background, independent of other scripts will not affect the performance of the page. You can continue to do anything willing to do: Click to select content, etc., at a time when web worker runs in the background.

Web Workers and the DOM
Since web worker is located in an external file, they can not access the following JavaScript objects:
window objects
document object
parent objects

Code specification:

Lowercase element names
HTML5 element name can use uppercase and lowercase letters.

Recommended to use lowercase letters:
a mix of capitalization style is very bad.
Developers typically use lowercase (similar XHTML).
Lowercase style looks more refreshing.
Lowercase letters easy to write.

recommend:

This is a paragraph.

Property Value

HTML5 attribute values ​​can not quotes.

We recommend using quotation marks property value:

If the property value contains spaces need to use quotation marks.
Mixed style is not recommended, it recommended a unified style.
Property values using quotation marks easy to read.

Do not add a blank line for no reason.

Add a blank line for each logical function blocks, which makes it easier to read.

Indent use two spaces, not recommended TAB.

Do not use unnecessary blank lines and indentation between short code.

recommend:

Rookie Tutorial

Rookie tutorial, learning is not only technology, but also dream. Rookie tutorial, learning is not only technology, but also dream. Rookie tutorial, learning is not only technology, but also dream. Rookie tutorial, learning is not only technology, but also dream.

Use lowercase file name

Most Web servers (Apache, Unix) are case sensitive: london.jpg can not London.jpg access.

Other Web servers (Microsoft, IIS) are not case sensitive: london.jpg can be accessed by London.jpg or london.jpg.

You have to maintain a unified style, we recommend consistent use lowercase file name.

File extension
HTML file suffix can be .html (or .htm).
CSS file extension is .css.
JavaScript file suffix .js.

JavaScript code standards

Spaces or operators
typically operator (= + - * /) before and after the need to add a space:

Example:
var X = Y + Z;
var values = [ "Volvo", "Saab", "Fiat"];

Variables and functions as a method to identify a small hump, that in addition to the first word, the other word capitalized (lowerCamelCase)
global variable to uppercase (UPPERCASE)
constants (such as PI) to uppercase (UPPERCASE)
variable name if you use these kinds of rules: hyp-hens, camelCase, or under_scores?

HTML and CSS dash (-) characters:

HTML5 attributes may DATA- (eg: data-quantity, data-price) as a prefix.

CSS uses - to connect the property name (font-size).

Note - generally considered to be a subtraction in JavaScript, it is not allowed.
Underline:

Many programmers prefer to use an underscore (eg: date_of_birth), especially in the SQL database.

PHP language usually use an underscore.

Pascal spelling (PascalCase):

Pascal spelling (PascalCase) in the C language in many languages.

Hump ​​law:

JavaScript is commonly recommended method hump, jQuery and other JavaScript libraries use hump law.

Note the variable names do not start with $ mark, with many JavaScript libraries will clash.

Released eight original articles · won praise 1 · views 9899

Guess you like

Origin blog.csdn.net/hello250sunshine/article/details/104104435