зеркало из https://github.com/mozilla/gecko-dev.git
196 строки
6.6 KiB
JavaScript
196 строки
6.6 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
(function(f) {
|
|
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
|
module.exports = f(require('devtools/client/shared/vendor/react'));
|
|
/* global define */
|
|
} else if (typeof define === 'function' && define.amd) {
|
|
define(['devtools/client/shared/vendor/react'], f);
|
|
} else {
|
|
var g;
|
|
if (typeof window !== 'undefined') {
|
|
g = window;
|
|
} else if (typeof global !== 'undefined') {
|
|
g = global;
|
|
} else if (typeof self !== 'undefined') {
|
|
g = self;
|
|
} else {
|
|
g = this;
|
|
}
|
|
|
|
if (typeof g.React === 'undefined') {
|
|
throw Error('React module should be required before ReactDOMFactories');
|
|
}
|
|
|
|
g.ReactDOMFactories = f(g.React);
|
|
}
|
|
})(function(React) {
|
|
/**
|
|
* Create a factory that creates HTML tag elements.
|
|
*/
|
|
function createDOMFactory(type) {
|
|
var factory = React.createElement.bind(null, type);
|
|
// Expose the type on the factory and the prototype so that it can be
|
|
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
|
|
// This should not be named `constructor` since this may not be the function
|
|
// that created the element, and it may not even be a constructor.
|
|
factory.type = type;
|
|
return factory;
|
|
};
|
|
|
|
/**
|
|
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
|
|
*/
|
|
var ReactDOMFactories = {
|
|
a: createDOMFactory('a'),
|
|
abbr: createDOMFactory('abbr'),
|
|
address: createDOMFactory('address'),
|
|
area: createDOMFactory('area'),
|
|
article: createDOMFactory('article'),
|
|
aside: createDOMFactory('aside'),
|
|
audio: createDOMFactory('audio'),
|
|
b: createDOMFactory('b'),
|
|
base: createDOMFactory('base'),
|
|
bdi: createDOMFactory('bdi'),
|
|
bdo: createDOMFactory('bdo'),
|
|
big: createDOMFactory('big'),
|
|
blockquote: createDOMFactory('blockquote'),
|
|
body: createDOMFactory('body'),
|
|
br: createDOMFactory('br'),
|
|
button: createDOMFactory('button'),
|
|
canvas: createDOMFactory('canvas'),
|
|
caption: createDOMFactory('caption'),
|
|
cite: createDOMFactory('cite'),
|
|
code: createDOMFactory('code'),
|
|
col: createDOMFactory('col'),
|
|
colgroup: createDOMFactory('colgroup'),
|
|
data: createDOMFactory('data'),
|
|
datalist: createDOMFactory('datalist'),
|
|
dd: createDOMFactory('dd'),
|
|
del: createDOMFactory('del'),
|
|
details: createDOMFactory('details'),
|
|
dfn: createDOMFactory('dfn'),
|
|
dialog: createDOMFactory('dialog'),
|
|
div: createDOMFactory('div'),
|
|
dl: createDOMFactory('dl'),
|
|
dt: createDOMFactory('dt'),
|
|
em: createDOMFactory('em'),
|
|
embed: createDOMFactory('embed'),
|
|
fieldset: createDOMFactory('fieldset'),
|
|
figcaption: createDOMFactory('figcaption'),
|
|
figure: createDOMFactory('figure'),
|
|
footer: createDOMFactory('footer'),
|
|
form: createDOMFactory('form'),
|
|
h1: createDOMFactory('h1'),
|
|
h2: createDOMFactory('h2'),
|
|
h3: createDOMFactory('h3'),
|
|
h4: createDOMFactory('h4'),
|
|
h5: createDOMFactory('h5'),
|
|
h6: createDOMFactory('h6'),
|
|
head: createDOMFactory('head'),
|
|
header: createDOMFactory('header'),
|
|
hgroup: createDOMFactory('hgroup'),
|
|
hr: createDOMFactory('hr'),
|
|
html: createDOMFactory('html'),
|
|
i: createDOMFactory('i'),
|
|
iframe: createDOMFactory('iframe'),
|
|
img: createDOMFactory('img'),
|
|
input: createDOMFactory('input'),
|
|
ins: createDOMFactory('ins'),
|
|
kbd: createDOMFactory('kbd'),
|
|
keygen: createDOMFactory('keygen'),
|
|
label: createDOMFactory('label'),
|
|
legend: createDOMFactory('legend'),
|
|
li: createDOMFactory('li'),
|
|
link: createDOMFactory('link'),
|
|
main: createDOMFactory('main'),
|
|
map: createDOMFactory('map'),
|
|
mark: createDOMFactory('mark'),
|
|
menu: createDOMFactory('menu'),
|
|
menuitem: createDOMFactory('menuitem'),
|
|
meta: createDOMFactory('meta'),
|
|
meter: createDOMFactory('meter'),
|
|
nav: createDOMFactory('nav'),
|
|
noscript: createDOMFactory('noscript'),
|
|
object: createDOMFactory('object'),
|
|
ol: createDOMFactory('ol'),
|
|
optgroup: createDOMFactory('optgroup'),
|
|
option: createDOMFactory('option'),
|
|
output: createDOMFactory('output'),
|
|
p: createDOMFactory('p'),
|
|
param: createDOMFactory('param'),
|
|
picture: createDOMFactory('picture'),
|
|
pre: createDOMFactory('pre'),
|
|
progress: createDOMFactory('progress'),
|
|
q: createDOMFactory('q'),
|
|
rp: createDOMFactory('rp'),
|
|
rt: createDOMFactory('rt'),
|
|
ruby: createDOMFactory('ruby'),
|
|
s: createDOMFactory('s'),
|
|
samp: createDOMFactory('samp'),
|
|
script: createDOMFactory('script'),
|
|
section: createDOMFactory('section'),
|
|
select: createDOMFactory('select'),
|
|
small: createDOMFactory('small'),
|
|
source: createDOMFactory('source'),
|
|
span: createDOMFactory('span'),
|
|
strong: createDOMFactory('strong'),
|
|
style: createDOMFactory('style'),
|
|
sub: createDOMFactory('sub'),
|
|
summary: createDOMFactory('summary'),
|
|
sup: createDOMFactory('sup'),
|
|
table: createDOMFactory('table'),
|
|
tbody: createDOMFactory('tbody'),
|
|
td: createDOMFactory('td'),
|
|
textarea: createDOMFactory('textarea'),
|
|
tfoot: createDOMFactory('tfoot'),
|
|
th: createDOMFactory('th'),
|
|
thead: createDOMFactory('thead'),
|
|
time: createDOMFactory('time'),
|
|
title: createDOMFactory('title'),
|
|
tr: createDOMFactory('tr'),
|
|
track: createDOMFactory('track'),
|
|
u: createDOMFactory('u'),
|
|
ul: createDOMFactory('ul'),
|
|
var: createDOMFactory('var'),
|
|
video: createDOMFactory('video'),
|
|
wbr: createDOMFactory('wbr'),
|
|
|
|
// SVG
|
|
circle: createDOMFactory('circle'),
|
|
clipPath: createDOMFactory('clipPath'),
|
|
defs: createDOMFactory('defs'),
|
|
ellipse: createDOMFactory('ellipse'),
|
|
g: createDOMFactory('g'),
|
|
image: createDOMFactory('image'),
|
|
line: createDOMFactory('line'),
|
|
linearGradient: createDOMFactory('linearGradient'),
|
|
mask: createDOMFactory('mask'),
|
|
path: createDOMFactory('path'),
|
|
pattern: createDOMFactory('pattern'),
|
|
polygon: createDOMFactory('polygon'),
|
|
polyline: createDOMFactory('polyline'),
|
|
radialGradient: createDOMFactory('radialGradient'),
|
|
rect: createDOMFactory('rect'),
|
|
stop: createDOMFactory('stop'),
|
|
svg: createDOMFactory('svg'),
|
|
text: createDOMFactory('text'),
|
|
tspan: createDOMFactory('tspan'),
|
|
};
|
|
|
|
// due to wrapper and conditionals at the top, this will either become
|
|
// `module.exports ReactDOMFactories` if that is available,
|
|
// otherwise it will be defined via `define(['react'], ReactDOMFactories)`
|
|
// if that is available,
|
|
// otherwise it will be defined as global variable.
|
|
return ReactDOMFactories;
|
|
});
|
|
|