mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Fix/amp example (#1755)
* Using developit/unfetch as the Fetch API polyfill * Fixed amp example checking if the amp attribute is already present * Fix lint
This commit is contained in:
parent
f82e52935d
commit
865263d24a
|
@ -1,13 +1,16 @@
|
||||||
import Document, { Head } from 'next/document'
|
import Document, { Head } from 'next/document'
|
||||||
import { DOMProperty } from 'react-dom/lib/ReactInjection'
|
import { DOMProperty } from 'react-dom/lib/ReactInjection'
|
||||||
|
import { properties as DOMProperties } from 'react-dom/lib/DOMProperty'
|
||||||
|
|
||||||
// By default React limit the set of valid DOM elements and attributes
|
// By default React limit the set of valid DOM elements and attributes
|
||||||
// (https://github.com/facebook/react/issues/140) this config whitelist
|
// (https://github.com/facebook/react/issues/140) this config whitelist
|
||||||
// Amp elements/attributes
|
// Amp elements/attributes
|
||||||
DOMProperty.injectDOMPropertyConfig({
|
if (typeof DOMProperties.amp === 'undefined') {
|
||||||
|
DOMProperty.injectDOMPropertyConfig({
|
||||||
Properties: { amp: DOMProperty.MUST_USE_ATTRIBUTE },
|
Properties: { amp: DOMProperty.MUST_USE_ATTRIBUTE },
|
||||||
isCustomAttribute: attributeName => attributeName.startsWith('amp-')
|
isCustomAttribute: attributeName => attributeName.startsWith('amp-')
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export default class MyDocument extends Document {
|
export default class MyDocument extends Document {
|
||||||
render () {
|
render () {
|
||||||
|
|
Loading…
Reference in a new issue