- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 03 Mar 2011 15:08:12 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/css In directory hutz:/tmp/cvs-serv4982/css Modified Files: TagSoupStyleSheetHandler.java Log Message: first stab at handing <link> without @type set Index: TagSoupStyleSheetHandler.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/TagSoupStyleSheetHandler.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- TagSoupStyleSheetHandler.java 19 Jan 2011 18:37:49 -0000 1.7 +++ TagSoupStyleSheetHandler.java 3 Mar 2011 15:08:10 -0000 1.8 @@ -253,37 +253,11 @@ String href = atts.getValue("href"); if (Util.onDebug) { - System.err.println("link rel=\"" + rel + System.err.println("TAGSOUP: link rel=\"" + rel + "\" type=\"" + type + "\"" + " href=\"" + href + "\""); } - if (type == null) { - return; - } - MimeType mt = null; - try { - mt = new MimeType(type); - } catch (MimeTypeFormatException mtfe) { - return; - } - if (MimeType.TEXT_CSS.match(mt) != - MimeType.MATCH_SPECIFIC_SUBTYPE) { - return; - } - if (href == null) { - int line = -1; - if (locator != null) { - line = locator.getLineNumber(); - } - CssError er = - new CssError(baseURI.toString(), line, - new InvalidParamException("unrecognized.link", ac)); - Errors ers = new Errors(); - ers.addError(er); - styleSheetParser.notifyErrors(ers); - return; - } if ((rel != null) && rel.toLowerCase().indexOf("stylesheet") != -1) { @@ -291,6 +265,42 @@ // @@TODO alternate stylesheet URL url; + // first we check if there is an href + if (href == null) { + int line = -1; + + if (locator != null) { + line = locator.getLineNumber(); + } + CssError er = + new CssError(baseURI.toString(), line, + new InvalidParamException("unrecognized.link", ac)); + Errors ers = new Errors(); + ers.addError(er); + styleSheetParser.notifyErrors(ers); + return; + } + // If so, check the type + if (type == null) { + int line = (locator != null ? locator.getLineNumber() : -1); + Warning w = new Warning(baseURI.toString(), line, + "link-type", 0, ac); + Warnings warnings = new Warnings(ac.getWarningLevel()); + warnings.addWarning(w); + styleSheetParser.notifyWarnings(warnings); + } else { + MimeType mt = null; + try { + mt = new MimeType(type); + } catch (MimeTypeFormatException mtfe) { + return; + } + if (MimeType.TEXT_CSS.match(mt) != + MimeType.MATCH_SPECIFIC_SUBTYPE) { + return; + } + } + // then prepare for parsing try { if (baseURI != null) { url = new URL(baseURI, href);
Received on Thursday, 3 March 2011 15:08:17 UTC