为什么这段代码在我的 shopify 主题文件中?

Why is this code in my shopify theme file?

我注意到这几行代码都提到了 IE9(我假设大多数人都没有使用它)。

  <!--[if (gt IE 9)|!(IE)]><!--><script src="{{ 'lazysizes.min.js' | asset_url }}" async="async"></script><!--<![endif]-->
  <!--[if lte IE 9]><script src="{{ 'lazysizes.min.js' | asset_url }}"></script><![endif]-->

  {% if template.directory == 'customers' %}
    <!--[if (gt IE 9)|!(IE)]><!--><script src="{{ 'shopify_common.js' | shopify_asset_url }}" defer="defer"></script><!--<![endif]-->
    <!--[if lte IE 9]><script src="{{ 'shopify_common.js' | shopify_asset_url }}"></script><![endif]-->
  {% endif %}

  <!--[if (gt IE 9)|!(IE)]><!--><script src="{{ 'vendor.js' | asset_url }}"></script><!--<![endif]-->
  <!--[if lt IE 9]><script src="{{ 'vendor.js' | asset_url }}"></script><![endif]-->

此代码会被视为过时吗?

如果你想移除对 IE 9 或更早版本的支持,你可以移除 if let IE 9 部分,但另一个

<!--[if (gt IE 9)|!(IE)]><!-->

这是针对非IE浏览器和IE 9以上浏览器的,我觉得你应该保留。

The extra "<!" is ignored by non-IE browsers; it is also ignored by IE regardless of the condition because if false, everything within the conditional comment is ignored, and if true, the resulting tag <!--> is unrecognized and therefore ignored.

关于此的更多阅读https://en.wikipedia.org/wiki/Conditional_comment