I use this code to import only partial divs from one page to another:
<!DOCTYPE html>
<html>
<head>
<link rel="import" href="html/source.html">
</head>
<body>
<script>
var link = document.querySelector('link[rel="import"]');
var content = link.import;
var el = content.querySelector('#mainModals');
document.body.appendChild(el.cloneNode(true));
</script>
</body>
It works fine in Chrome, but it doesn't work in Safari.
Error: TypeError: undefined is not an object (rating "content.querySelector")
source
share