Socket
Socket
Sign inDemoInstall

@shopify/react-html

Package Overview
Dependencies
Maintainers
12
Versions
191
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/react-html - npm Package Compare versions

Comparing version 7.1.0 to 7.1.1

6

CHANGELOG.md

@@ -13,2 +13,8 @@ # Changelog

## 7.1.1 - 2019-02-27
### Fixed
- Fixed an issue where `link`/ `meta` tags that were identical to previously-added tags would be removed and re-appended to `document.head` [#536](https://github.com/Shopify/quilt/pull/536)
## 7.1.0 - 2019-02-20

@@ -15,0 +21,0 @@

133

dist/context.js

@@ -24,2 +24,3 @@ "use strict";

updateOnClient(state);
_this.queuedUpdate = undefined;
});

@@ -37,3 +38,3 @@ });

function updateOnClient(state) {
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e;
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
var title = state.title, metas = state.metas, links = state.links;

@@ -45,31 +46,45 @@ var titleElement = document.querySelector('title');

}
return;
}
if (titleElement == null) {
titleElement = document.createElement('title');
document.head.appendChild(titleElement);
else {
if (titleElement == null) {
titleElement = document.createElement('title');
document.head.appendChild(titleElement);
}
titleElement.setAttribute(utilities_1.MANAGED_ATTRIBUTE, 'true');
titleElement.textContent = title;
}
titleElement.setAttribute(utilities_1.MANAGED_ATTRIBUTE, 'true');
titleElement.textContent = title;
var fragment = document.createDocumentFragment();
try {
for (var metas_1 = tslib_1.__values(metas), metas_1_1 = metas_1.next(); !metas_1_1.done; metas_1_1 = metas_1.next()) {
var meta = metas_1_1.value;
var element = document.createElement('meta');
element.setAttribute(utilities_1.MANAGED_ATTRIBUTE, 'true');
var oldMetas = Array.from(document.head.querySelectorAll("meta[" + utilities_1.MANAGED_ATTRIBUTE + "]"));
var _loop_1 = function (meta) {
var e_5, _a;
var element = document.createElement('meta');
element.setAttribute(utilities_1.MANAGED_ATTRIBUTE, 'true');
try {
for (var _b = tslib_1.__values(Object.entries(meta)), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = tslib_1.__read(_c.value, 2), attribute = _d[0], value = _d[1];
element.setAttribute(attribute, value);
}
}
catch (e_5_1) { e_5 = { error: e_5_1 }; }
finally {
try {
for (var _f = tslib_1.__values(Object.entries(meta)), _g = _f.next(); !_g.done; _g = _f.next()) {
var _h = tslib_1.__read(_g.value, 2), attribute = _h[0], value = _h[1];
element.setAttribute(attribute, value);
}
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
}
finally { if (e_2) throw e_2.error; }
}
finally { if (e_5) throw e_5.error; }
}
var matchingOldMetaIndex = oldMetas.findIndex(function (oldMeta) {
return oldMeta.isEqualNode(element);
});
if (matchingOldMetaIndex >= 0) {
oldMetas.splice(matchingOldMetaIndex, 1);
}
else {
fragment.appendChild(element);
}
};
try {
for (var metas_1 = tslib_1.__values(metas), metas_1_1 = metas_1.next(); !metas_1_1.done; metas_1_1 = metas_1.next()) {
var meta = metas_1_1.value;
_loop_1(meta);
}
}

@@ -83,27 +98,53 @@ catch (e_1_1) { e_1 = { error: e_1_1 }; }

}
try {
for (var links_1 = tslib_1.__values(links), links_1_1 = links_1.next(); !links_1_1.done; links_1_1 = links_1.next()) {
var link = links_1_1.value;
var element = document.createElement('link');
element.setAttribute(utilities_1.MANAGED_ATTRIBUTE, 'true');
var oldLinks = Array.from(document.head.querySelectorAll("link[" + utilities_1.MANAGED_ATTRIBUTE + "]"));
var _loop_2 = function (link) {
var e_6, _a;
var element = document.createElement('link');
element.setAttribute(utilities_1.MANAGED_ATTRIBUTE, 'true');
try {
for (var _b = tslib_1.__values(Object.entries(link)), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = tslib_1.__read(_c.value, 2), attribute = _d[0], value = _d[1];
element.setAttribute(attribute, value);
}
}
catch (e_6_1) { e_6 = { error: e_6_1 }; }
finally {
try {
for (var _j = tslib_1.__values(Object.entries(link)), _k = _j.next(); !_k.done; _k = _j.next()) {
var _l = tslib_1.__read(_k.value, 2), attribute = _l[0], value = _l[1];
element.setAttribute(attribute, value);
}
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_k && !_k.done && (_d = _j.return)) _d.call(_j);
}
finally { if (e_4) throw e_4.error; }
}
finally { if (e_6) throw e_6.error; }
}
var matchingOldLinkIndex = oldLinks.findIndex(function (oldLink) {
return oldLink.isEqualNode(element);
});
if (matchingOldLinkIndex >= 0) {
oldLinks.splice(matchingOldLinkIndex, 1);
}
else {
fragment.appendChild(element);
}
};
try {
for (var links_1 = tslib_1.__values(links), links_1_1 = links_1.next(); !links_1_1.done; links_1_1 = links_1.next()) {
var link = links_1_1.value;
_loop_2(link);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (links_1_1 && !links_1_1.done && (_b = links_1.return)) _b.call(links_1);
}
finally { if (e_2) throw e_2.error; }
}
try {
for (var oldLinks_1 = tslib_1.__values(oldLinks), oldLinks_1_1 = oldLinks_1.next(); !oldLinks_1_1.done; oldLinks_1_1 = oldLinks_1.next()) {
var link = oldLinks_1_1.value;
link.remove();
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (links_1_1 && !links_1_1.done && (_c = links_1.return)) _c.call(links_1);
if (oldLinks_1_1 && !oldLinks_1_1.done && (_c = oldLinks_1.return)) _c.call(oldLinks_1);
}

@@ -113,15 +154,15 @@ finally { if (e_3) throw e_3.error; }

try {
for (var _m = tslib_1.__values(document.querySelectorAll("meta[" + utilities_1.MANAGED_ATTRIBUTE + "], link[" + utilities_1.MANAGED_ATTRIBUTE + "]")), _o = _m.next(); !_o.done; _o = _m.next()) {
var node = _o.value;
node.remove();
for (var oldMetas_1 = tslib_1.__values(oldMetas), oldMetas_1_1 = oldMetas_1.next(); !oldMetas_1_1.done; oldMetas_1_1 = oldMetas_1.next()) {
var meta = oldMetas_1_1.value;
meta.remove();
}
}
catch (e_5_1) { e_5 = { error: e_5_1 }; }
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_o && !_o.done && (_e = _m.return)) _e.call(_m);
if (oldMetas_1_1 && !oldMetas_1_1.done && (_d = oldMetas_1.return)) _d.call(oldMetas_1);
}
finally { if (e_5) throw e_5.error; }
finally { if (e_4) throw e_4.error; }
}
document.head.appendChild(fragment);
}
{
"name": "@shopify/react-html",
"version": "7.1.0",
"version": "7.1.1",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "A component to render your react app with no static HTML.",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc