Skip to content

Commit

Permalink
fix: remove single tags from zeit whatsapp content share plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
nistormihai committed Mar 28, 2016
1 parent 71d7143 commit acc3359
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ define([
content = content.replace(/<(b|strong|em|i|a)\b[^>]*>(.*?)<\/\1>/ig, '$2');
// all other tags should be removed including the text they're wrapped around.
content = content.replace(/<([a-z][a-z0-9]*)\b[^>]*>(.*?)<\/\1>/ig, '');
// clear also single tags
content = content.replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>/ig, '');
// encode it properly.
content = fixedEncodeURIComp(content);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ define([
// on zeit request:
// <b>, <strong>, <em>, <i> and <a> tags should be removed while leaving the text they're wrapped around.
content = content.replace(/<(b|strong|em|i|a)\b[^>]*>(.*?)<\/\1>/ig, '$2');
// all other tags should be removed including the text they're wrapped around.
// all other tags should be removed including the text they're wrapped around.
content = content.replace(/<([a-z][a-z0-9]*)\b[^>]*>(.*?)<\/\1>/ig, '');
// clear also single tags
content = content.replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>/ig, '');
// encode it properly.
content = fixedEncodeURIComp(content);

Expand Down

0 comments on commit acc3359

Please sign in to comment.