Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add patchMotionTags for legacy browsers which don't support Proxy
- Loading branch information
Showing
5 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
// borrowed from react-dom-factories | ||
export const domTags = [ | ||
"a", | ||
"abbr", | ||
"address", | ||
"area", | ||
"article", | ||
"aside", | ||
"audio", | ||
"b", | ||
"base", | ||
"bdi", | ||
"bdo", | ||
"big", | ||
"blockquote", | ||
"body", | ||
"br", | ||
"button", | ||
"canvas", | ||
"caption", | ||
"cite", | ||
"code", | ||
"col", | ||
"colgroup", | ||
"data", | ||
"datalist", | ||
"dd", | ||
"del", | ||
"details", | ||
"dfn", | ||
"dialog", | ||
"div", | ||
"dl", | ||
"dt", | ||
"em", | ||
"embed", | ||
"fieldset", | ||
"figcaption", | ||
"figure", | ||
"footer", | ||
"form", | ||
"h1", | ||
"h2", | ||
"h3", | ||
"h4", | ||
"h5", | ||
"h6", | ||
"head", | ||
"header", | ||
"hgroup", | ||
"hr", | ||
"html", | ||
"i", | ||
"iframe", | ||
"img", | ||
"input", | ||
"ins", | ||
"kbd", | ||
"keygen", | ||
"label", | ||
"legend", | ||
"li", | ||
"link", | ||
"main", | ||
"map", | ||
"mark", | ||
"menu", | ||
"menuitem", | ||
"meta", | ||
"meter", | ||
"nav", | ||
"noscript", | ||
"object", | ||
"ol", | ||
"optgroup", | ||
"option", | ||
"output", | ||
"p", | ||
"param", | ||
"picture", | ||
"pre", | ||
"progress", | ||
"q", | ||
"rp", | ||
"rt", | ||
"ruby", | ||
"s", | ||
"samp", | ||
"script", | ||
"section", | ||
"select", | ||
"small", | ||
"source", | ||
"span", | ||
"strong", | ||
"style", | ||
"sub", | ||
"summary", | ||
"sup", | ||
"table", | ||
"tbody", | ||
"td", | ||
"textarea", | ||
"tfoot", | ||
"th", | ||
"thead", | ||
"time", | ||
"title", | ||
"tr", | ||
"track", | ||
"u", | ||
"ul", | ||
"var", | ||
"video", | ||
"wbr", | ||
// SVG | ||
"circle", | ||
"clipPath", | ||
"defs", | ||
"ellipse", | ||
"foreignObject", | ||
"g", | ||
"image", | ||
"line", | ||
"linearGradient", | ||
"marker", | ||
"mask", | ||
"path", | ||
"pattern", | ||
"polygon", | ||
"polyline", | ||
"radialGradient", | ||
"rect", | ||
"stop", | ||
"svg", | ||
"text", | ||
"tspan", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// loaded from ./dom-tags | ||
export const motionTags: string[] = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { motionTags } from "./motion-tags" | ||
import { domTags } from "./dom-tags" | ||
|
||
// tree-shakable patch for legacy browsers which don't support Proxy | ||
export const patchMotionTags = (() => { | ||
motionTags.push(...domTags) | ||
return () => {} | ||
})() |