Skip to content

Commit

Permalink
Fix/amp example (vercel#1755)
Browse files Browse the repository at this point in the history
* Using developit/unfetch as the Fetch API polyfill

* Fixed amp example checking if the amp attribute is already present

* Fix lint
  • Loading branch information
impronunciable authored and timneutkens committed Apr 19, 2017
1 parent f82e529 commit 865263d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions examples/with-amp/pages/_document.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import Document, { Head } from 'next/document'
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
// (https://github.com/facebook/react/issues/140) this config whitelist
// Amp elements/attributes
DOMProperty.injectDOMPropertyConfig({
Properties: { amp: DOMProperty.MUST_USE_ATTRIBUTE },
isCustomAttribute: attributeName => attributeName.startsWith('amp-')
})
if (typeof DOMProperties.amp === 'undefined') {
DOMProperty.injectDOMPropertyConfig({
Properties: { amp: DOMProperty.MUST_USE_ATTRIBUTE },
isCustomAttribute: attributeName => attributeName.startsWith('amp-')
})
}

export default class MyDocument extends Document {
render () {
Expand Down

0 comments on commit 865263d

Please sign in to comment.