Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: lib/src/prism/plugins/wpd/prism-wpd.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/src/prism/plugins/wpd/prism-wpd.js
diff --git a/lib/src/prism/plugins/wpd/prism-wpd.js b/lib/src/prism/plugins/wpd/prism-wpd.js
index 9c2c3075edd50852f0a973b603f9b23915357244..f02996731ddde6e5723279b3719929a8720fde88 100644
--- a/lib/src/prism/plugins/wpd/prism-wpd.js
+++ b/lib/src/prism/plugins/wpd/prism-wpd.js
@@ -1,6 +1,9 @@
(function(){
-if (!self.Prism) {
+if (
+ typeof self !== 'undefined' && !self.Prism ||
+ typeof global !== 'undefined' && !global.Prism
+) {
return;
}
@@ -41,9 +44,9 @@ if (Prism.languages.markup) {
'feFuncR': 1, 'feFuncG': 1, 'feFuncB': 1, 'feFuncA': 1, 'feComposite': 1, 'feConvolveMatrix': 1, 'feDiffuseLighting': 1, 'feDisplacementMap': 1,
'feFlood': 1, 'feGaussianBlur': 1, 'feImage': 1, 'feMerge': 1, 'feMergeNode': 1, 'feMorphology': 1, 'feOffset': 1, 'feSpecularLighting': 1,
'feTile': 1, 'feTurbulence': 1, 'feDistantLight': 1, 'fePointLight': 1, 'feSpotLight': 1, 'linearGradient': 1, 'radialGradient': 1, 'altGlyph': 1,
- 'textPath': 1, 'tref': 1, 'altglyph': 1, 'textpath': 1, 'tref': 1, 'altglyphdef': 1, 'altglyphitem': 1, 'clipPath': 1, 'color-profile': 1, 'cursor': 1,
- 'font-face': 1, 'font-face-format': 1, 'font-face-name': 1, 'font-face-src': 1, 'font-face-uri': 1, 'foreignObject': 1, 'glyph': 1, 'glyphRef': 1,
- 'hkern': 1, 'vkern': 1,
+ 'textPath': 1, 'tref': 1, 'altglyph': 1, 'textpath': 1, 'altglyphdef': 1, 'altglyphitem': 1, 'clipPath': 1, 'color-profile': 1, 'cursor': 1,
+ 'font-face': 1, 'font-face-format': 1, 'font-face-name': 1, 'font-face-src': 1, 'font-face-uri': 1, 'foreignObject': 1, 'glyphRef': 1,
+ 'hkern': 1, 'vkern': 1
},
MathML: {}
}
@@ -52,7 +55,7 @@ if (Prism.languages.markup) {
var language;
Prism.hooks.add('wrap', function(env) {
- if ((['tag-id'].indexOf(env.type) > -1
+ if ((env.type == 'tag-id'
|| (env.type == 'property' && env.content.indexOf('-') != 0)
|| (env.type == 'atrule-id'&& env.content.indexOf('@-') != 0)
|| (env.type == 'pseudo-class'&& env.content.indexOf(':-') != 0)
@@ -61,13 +64,13 @@ Prism.hooks.add('wrap', function(env) {
) && env.content.indexOf('<') === -1
) {
var searchURL = 'w/index.php?fulltext&search=';
-
+
env.tag = 'a';
var href = 'http://docs.webplatform.org/';
if (env.language == 'css') {
- href += 'wiki/css/'
+ href += 'wiki/css/';
if (env.type == 'property') {
href += 'properties/';
@@ -125,7 +128,7 @@ function getLanguage(tag) {
}
// Not in dictionary, perform check
- if (Tags.HTML[tagL] !== 0) {
+ if (Tags.HTML[tagL] !== 0 && typeof document !== 'undefined') {
var htmlInterface = (document.createElement(tag).toString().match(/\[object HTML(.+)Element\]/) || [])[1];
if (htmlInterface && htmlInterface != 'Unknown') {
@@ -136,7 +139,7 @@ function getLanguage(tag) {
Tags.HTML[tagL] = 0;
- if (Tags.SVG[tag] !== 0) {
+ if (Tags.SVG[tag] !== 0 && typeof document !== 'undefined') {
var svgInterface = (document.createElementNS('http://www.w3.org/2000/svg', tag).toString().match(/\[object SVG(.+)Element\]/) || [])[1];
if (svgInterface && svgInterface != 'Unknown') {
« no previous file with comments | « lib/src/prism/plugins/show-language/prism-show-language.min.js ('k') | lib/src/prism/plugins/wpd/prism-wpd.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698