看的是英文电子版的。没有细看,先做个阅读作为索引
<!DOCTYPE html>
<mete charset="uft-8">
####################
## new sectioning element
####################
* header
* footer
* section
* article
* aside
* nav
####################
## document.querySelector
####################
* querySelector() - return the first element matches
* querySelectorAll() - return all elements founded
####################
## Canvas
####################
####################
## Audio and Video
####################
<audio controls src="test.ogg">Your browser does not support video.</audio>
<audio controls>
<source src="a.ogg">
<source src="b.mp3">
</audio>
//作为背景音乐自动播放
<audio autoplay loop>
<source src="a.ogg">
</audio>
支持浏览器是否支持
var hasVideo = !!(document.createElement('video').canPlayType);
控件function
* load()
* play()
* pause()
* canPlayType(type)
控件只读属性(read-only attributes)
* duration
* paused
* ended
* startTime
* error
* currentSrc
可编辑属性(scriptable attributes)
* autoplay
* loop
* currentTime
* controls
* volume
* muted
* autobuffer
## 地理位置
navigator.geolocation
####################
## 通信API
####################
postMessage
window.postMessage('Hello, world', '
http://www.exapmple.com/ ');
// dangerous
element.innerHTML = e.data;
// Better
elemenet.textContent = e.data;
// checking for browser support
if (typeof window.postMessage === 'undefined') {
}
}
## WebSocket API
url = 'ws://localhost:8080/echo';
w = new WebSocket(url);
w.onopen = function(){}
w.onmessage = function(){}
w.onclose = function(){}
####################
## Form API
####################
!!不可替代Server端验证
HTML Forms vs. XForms
<input type="email">
<input type="tel">
<input type="url">
<input type="search">
<input type="range" min="10" max="20" step="5">
type:
* number
* color
* datetime
* datetime-local
* time
* date
* week
* month
attribute:
* placeholder
* autocomplete
* autofocus
* required
* maxLength
<input type='emal' list='cList'>
<datalist id='cList'>
<option value='
x@x.com ' label='x'>
<option value='
y@y.com ' label='y'>
</datalist>
//
document.getElementById("numInput").valueAsNumber(65);
Validation feedback
## Web Workders API
if (typeof Worker !== 'undefined') {}
work = new Workder('echoWorker.js');
####################
## Web Storage API
####################
if (window.sessionStorage){}
if (window.localStorage){}
window.sessionStorage.setItem('key', 'value');
window.sessionStorage.getItem('key');
window.sessionStorage.key = 'value';
window.sessionStorage.key;
interface Storage {
readonly attribute unsigned long length;
getter DOMString key(in unsigned long index);
getter any getItem(in DOMString key);
setter creator void setItem(in DOMString key, in any data);
deleter void removeItem(in DOMString key);
void clear();
}
####################
## Offline Web Application API
####################
if (window.applicationCache){}