Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Internal: Got rid of the 'linkElement' Symbol used to recognize view …
Browse files Browse the repository at this point in the history
…elements (see ckeditor/ckeditor5#1520).
  • Loading branch information
oleq committed Feb 12, 2019
1 parent b157f2f commit 6b3a055
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
* @module link/utils
*/

const linkElementSymbol = Symbol( 'linkElement' );

const ATTRIBUTE_WHITESPACES = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex
const SAFE_URL = /^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i;

Expand All @@ -19,7 +17,7 @@ const SAFE_URL = /^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))
* @returns {Boolean}
*/
export function isLinkElement( node ) {
return node.is( 'attributeElement' ) && !!node.getCustomProperty( linkElementSymbol );
return node.is( 'attributeElement', 'a' ) && node.hasAttribute( 'href' );
}

/**
Expand All @@ -31,7 +29,6 @@ export function isLinkElement( node ) {
export function createLinkElement( href, writer ) {
// Priority 5 - https://github.com/ckeditor/ckeditor5-link/issues/121.
const linkElement = writer.createAttributeElement( 'a', { href }, { priority: 5 } );
writer.setCustomProperty( linkElementSymbol, true, linkElement );

return linkElement;
}
Expand Down

0 comments on commit 6b3a055

Please sign in to comment.