Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
remove attribute and stylesheet path resolution from the polyfill. Th…
Browse files Browse the repository at this point in the history
…is is not supported in the spec so the polyfill shouldn’t do it.
  • Loading branch information
sorvell committed Jan 18, 2014
1 parent 4b414f6 commit f3be8f1
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 218 deletions.
2 changes: 2 additions & 0 deletions build.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[
"src/scope.js",
"src/Loader.js",
"src/HTMLImports.js",
"src/Parser.js",
"src/boot.js"
Expand Down
1 change: 0 additions & 1 deletion html-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ var thisFile = 'html-imports.js';
var scopeName = 'HTMLImports';
var modules = [
'src/scope.js',
'src/path.js',
'src/Loader.js',
'src/HTMLImports.js',
'src/Parser.js',
Expand Down
7 changes: 0 additions & 7 deletions src/HTMLImports.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ var IMPORT_LINK_TYPE = 'import';

if (!useNative) {
// imports
var path = scope.path;
var Loader = scope.Loader;
var xhr = scope.xhr;

Expand Down Expand Up @@ -118,8 +117,6 @@ if (!useNative) {
if (!document) {
// generate an HTMLDocument from data
document = makeDocument(resource, url);
// resolve resource paths relative to host document
//path.resolvePathsInHTML(document);
// cache document
importer.documents[url] = document;
// add nodes from this document to the loader queue
Expand All @@ -133,10 +130,6 @@ if (!useNative) {
// TODO(sorvell): fails for nodes inside <template>.content
// see https://code.google.com/p/chromium/issues/detail?id=249381.
elt.__resource = resource;
// css path fixups
if (isStylesheetLink(elt)) {
path.resolvePathsInStylesheet(elt);
}
}
};

Expand Down
3 changes: 1 addition & 2 deletions src/Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
this.checkDone();
},
require: function(elt) {
var url = path.nodeUrl(elt);
var url = elt.src || elt.href;
// ensure we have a standard url that can be used
// reliably for deduping.
url = path.makeAbsUrl(url);
// TODO(sjmiles): ad-hoc
elt.__nodeUrl = url;
// deduplication
Expand Down
31 changes: 4 additions & 27 deletions src/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var importParser = {
if (!document.__importParsed) {
// only parse once
document.__importParsed = true;
//console.group('parsing', scope.path.getDocumentUrl(document));
//console.group('parsing', document.baseURI);
var tracker = new LoadTracker(document, done);
// all parsable elements in inDocument (depth-first pre-order traversal)
var elts = document.querySelectorAll(importParser.selectors);
Expand All @@ -52,7 +52,7 @@ var importParser = {
elts = document.querySelectorAll(importParser.selectors);
}
}
//console.groupEnd('parsing', scope.path.getDocumentUrl(document));
//console.groupEnd('parsing', document.baseURI);
tracker.open();
} else if (done) {
done();
Expand All @@ -72,8 +72,6 @@ var importParser = {
linkElt.dispatchEvent(new CustomEvent('error', {bubbles: false}));
}
} else {
// TODO(sorvell): what about resolvePathsInStylesheet???
path.resolveNodeAttributes(linkElt);
this.parseGeneric(linkElt);
}
},
Expand All @@ -86,7 +84,6 @@ var importParser = {
parseStyle: function(elt) {
// TODO(sorvell): style element load event can just not fire so clone styles
elt = needsMainDocumentContext(elt) ? cloneStyle(elt) : elt;
path.resolveStyleElt(elt);
this.parseGeneric(elt);
},
parseGeneric: function(elt) {
Expand All @@ -108,7 +105,7 @@ var importParser = {
// calculate source map hint
var moniker = scriptElt.__nodeUrl;
if (!moniker) {
var moniker = scope.path.documentUrlFromNode(scriptElt);
moniker = scriptElt.ownerDocument.baseURI;
// there could be more than one script this url
var tag = '[' + Math.floor((Math.random()+1)*1000) + ']';
// TODO(sjmiles): Polymer hack, should be pluggable if we need to allow
Expand Down Expand Up @@ -171,7 +168,7 @@ LoadTracker.prototype = {
return;
}
if (this.pending <= 0 && this.callback) {
//console.log('done!', this.doc, scope.path.getDocumentUrl(this.doc));
//console.log('done!', this.doc, this.doc.baseURI);
this.isOpen = false;
this.callback();
}
Expand All @@ -197,26 +194,6 @@ function inMainDocument(elt) {
elt.ownerDocument.impl === document;
}

/*
if (scope.useNative) {
var path = scope.path;
importParser.selectors = [
'link[rel=' + IMPORT_LINK_TYPE + ']',
'link[rel=stylesheet]',
'style'
];
var parseGeneric = importParser.parseGeneric;
importParser.parseGeneric = function(elt) {
if (elt.href) {
var url = path.documentUrlFromNode(elt);
path.resolveNodeAttributes(elt, url);
}
parseGeneric(elt);
};
}
*/

// exports

scope.parser = importParser;
Expand Down
181 changes: 0 additions & 181 deletions src/path.js

This file was deleted.

0 comments on commit f3be8f1

Please sign in to comment.