Browse Source

data-no-instant

Alexandre Dieulot 6 years ago
parent
commit
c8bccc515a
2 changed files with 5 additions and 1 deletions
  1. 4 0
      instantpage.js
  2. 1 1
      test/app.js

+ 4 - 0
instantpage.js

@@ -47,6 +47,10 @@ function isPreloadable(linkElement) {
     return false
   }
 
+  if ('noInstant' in linkElement.dataset) {
+    return false
+  }
+
   return true
 }
 

+ 1 - 1
test/app.js

@@ -62,7 +62,7 @@ async function requestListener(req, res) {
 
     content += `<a href="${req.url}#anchor" id="anchor"><span>Same-page anchor</span></a>`
     content += `<a href="/${page}?${Math.random()}#anchor"><span>Other page anchor</span></a>`
-    content += `<a href="/${page}?${Math.random()}" data-instant="no"><span>Manually blacklisted link</span></a>`
+    content += `<a href="/${page}?${Math.random()}" data-no-instant><span>Manually blacklisted link</span></a>`
     content += `<a href="https://www.google.com/"><span>External link</span></a>`
 
     let footer = await fsPromises.readFile(path.resolve(__dirname, 'footer.html'))