forked from facebookarchive/draft-js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commandeers and applies PR feedback to facebookarchive#1877
- Loading branch information
Claudio Procida
committed
Nov 19, 2018
1 parent
d27b28b
commit de81349
Showing
10 changed files
with
111 additions
and
45 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,14 +1,21 @@ | ||
function isElement(node) { | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* @format | ||
* @flow | ||
* @emails oncall+draft_js | ||
*/ | ||
|
||
function isElement(node: ?Node): boolean { | ||
if (!node || !node.ownerDocument) { | ||
return false; | ||
} | ||
if (!node.ownerDocument.defaultView) { | ||
return node instanceof Element; | ||
} | ||
if (node instanceof node.ownerDocument.defaultView.Element) { | ||
return true; | ||
} | ||
return false; | ||
return node.nodeType === Node.ELEMENT_NODE; | ||
} | ||
|
||
module.exports = isElement; |
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 |
---|---|---|
@@ -1,14 +1,23 @@ | ||
function isHTMLAnchorElement(node) { | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* @format | ||
* @flow | ||
* @emails oncall+draft_js | ||
*/ | ||
|
||
const isElement = require('isElement'); | ||
|
||
function isHTMLAnchorElement(node: ?Node): boolean { | ||
if (!node || !node.ownerDocument) { | ||
return false; | ||
} | ||
if (!node.ownerDocument.defaultView) { | ||
return node instanceof HTMLAnchorElement; | ||
} | ||
if (node instanceof node.ownerDocument.defaultView.HTMLAnchorElement) { | ||
return true; | ||
} | ||
return false; | ||
return isElement(node) && node.nodeName === 'A'; | ||
} | ||
|
||
module.exports = isHTMLAnchorElement; |
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 |
---|---|---|
@@ -1,14 +1,23 @@ | ||
function isHTMLImageElement(node) { | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* @format | ||
* @flow | ||
* @emails oncall+draft_js | ||
*/ | ||
|
||
const isElement = require('isElement'); | ||
|
||
function isHTMLImageElement(node: ?Node): boolean { | ||
if (!node || !node.ownerDocument) { | ||
return false; | ||
} | ||
if (!node.ownerDocument.defaultView) { | ||
return node instanceof HTMLImageElement; | ||
} | ||
if (node instanceof node.ownerDocument.defaultView.HTMLImageElement) { | ||
return true; | ||
} | ||
return false; | ||
return isElement(node) && node.nodeName === 'IMG'; | ||
} | ||
|
||
module.exports = isHTMLImageElement; |
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