Code Monkey home page Code Monkey logo

html's Introduction

Dart CI pub package package publisher

A Dart implementation of an HTML5 parser.

Usage

Parsing HTML is easy!

import 'package:html/parser.dart';

void main() {
  var document = parse(
      '<body>Hello world! <a href="www.html5rocks.com">HTML5 rocks!');
  print(document.outerHtml);
}

You can pass a String or list of bytes to parse. There's also parseFragment for parsing a document fragment, and HtmlParser if you want more low level control.

Background

This package was a port of the Python html5lib library.

html's People

Contributors

chalin avatar cvolzke4 avatar dependabot[bot] avatar devoncarew avatar dgrove avatar floitschg avatar franklinyow avatar kabagouda avatar keertip avatar kevmoo avatar lrhn avatar munificent avatar natebosch avatar nex3 avatar nshahan avatar oprypin avatar patefacio avatar ronjb avatar scheglov avatar sethladd avatar sgjesse avatar sigmundch avatar srawlins avatar whesse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

html's Issues

fix htmlinputstream, tokenizer to use codepoints and build strings as late as possible

<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="96" height="96"hspace="10"> Issue by sethladd
Originally opened as dart-lang/sdk#16704


There's a todo explaining, but I think we can radically simplify this class and base it on codepoints instead of building up string chunks. I'd also like to remove the RegExp that is used for "charsUntil"

This could be done in two phases also, first simplify inputstream then tokenizer

Test fails on the vm: html/test/selectors/level1_baseline_test

When run on the vm, one of the subtests of test/selectors/level1_baseline_test fails:

FAIL: Detached Element.querySelectorAll: Attribute whitespace-separated list selector, matching custom data-* attribute with unicode escaped value: [data-attr-whitespace~="\0000e9"]

This should be added to a status file, or removed from the test, or fixed, so the package buildbot turns green.

Internal type error with duplicate attributes and generateSpans: true

Repro:

import 'package:html/parser.dart' as html;

void main(List<String> args) {
  var dom = html.parse('<div duplicate duplicate>', generateSpans: true);
  print(dom.querySelector('div').attributeSpans);
}

This results in:

Unhandled exception:
type 'ParseErrorToken' is not a subtype of type 'StartTagToken' in type cast where
  ParseErrorToken is from package:html/src/token.dart
  StartTagToken is from package:html/src/token.dart

#0      Object._as (dart:core-patch/object_patch.dart:73)
#1      Node._ensureAttributeSpans (package:html/dom.dart:286:35)
#2      Node.attributeSpans (package:html/dom.dart:173:5)
#3      main (file:///khome/ryan/langtest/dart/html_bug/bin/html_bug.dart:5:34)
#4      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:263)
#5      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)

Unable to query nodes that exist at the same time use tag and class

import 'package:flutter_test/flutter_test.dart';
import 'package:html/parser.dart';

void main() {
	testWidgets('patch file', (WidgetTester tester) async {
		final doc = parse('<div class="aa"><span>text</span><span>text 2</span></div>');
		print(doc.querySelectorAll('.aa')); //ok
		print(doc.querySelectorAll('.aa span'));//ok
		
		print(doc.querySelectorAll('div.aa'));//ok
		print(doc.querySelectorAll('div.aa span'));//error
	});
}

html5lib parses extremely slow certain type of content

<img src="https://avatars.githubusercontent.com/u/148256?v=3" align="left" width="96" height="96"hspace="10"> Issue by kaisellgren
Originally opened as dart-lang/sdk#15076


The following code demonstrates a very slow parsing speed:

  http.read('https://www.facebook.com/MARCA').then((c) {
    htmlParser.parse(c);
  });

For most websites out there, it's fast, but for a few and this site in particular, it parses in around 20-25 seconds.

Template tag within table wrongly reports voodoo error

From spec: https://html.spec.whatwg.org/#parsing-main-intable

12.2.5.4.9 The "in table" insertion mode

When the user agent is to apply the rules for the "in table" insertion mode, the user agent must handle the token as follows:

...

A start tag whose tag name is one of: "style", "script", "template"
An end tag whose tag name is "template"
Process the token using the rules for the "in head" insertion mode.

Original bug filed with us: dart-archive/angular_analyzer_plugin#239

CSS rects should use getBoundingClientRect instead of offsetWidth and offsetHeight

Getters like contentEdge, paddingEdge, marginEdge and borderEdge use offsetWidth and offsetHeight which both return a rounded value of the width and height of the element. This results in incorrect arithmetic when programmatically calculating element sizes. Only getBoundingClientRect returns fractional values. I think this would be the correct way to provide these properties and would match how jQuery works too.

html5lib test case where two equivalent selectors give different result

Originally opened as dart-lang/sdk#21820

This issue was originally filed by [email protected]


What steps will reproduce the problem?

import 'package:html5lib/dom.dart' as dom;
import 'package:unittest/unittest.dart';

main() {
  group('Select b inside span', () {
    final div = new dom.Element.html(
        r"""<div><span class="prep_nove"><b>1</b></span></div>""");
    
    test('using two separate selectors', () {
      var b = div.querySelector("span.prep_nove").querySelector("b");
      expect(b, isNotNull);
      expect(b.text, '1');
    });
    test('using one combined selector', () {
      var b = div.querySelector("span.prep_nove b");
      expect(b, isNotNull);
      expect(b.text, '1');
    });
  });
}

What is the expected output? What do you see instead?

Observatory listening on http://127.0.0.1:56811
unittest-suite-wait-for-done
PASS: Select b inside span using two separate selectors
FAIL: Select b inside span using one combined selector
  Expected: not null
    Actual: <null>

What version of the product are you using?

Dart Editor version 1.9.0.dev_00_00 (DEV)
Dart SDK version 1.9.0-dev.0.0
html5lib 0.12.0

cleanup: use char codes instead of strings

related to #7, there's a lot of too-eager char codes -> string conversions, and a lot of 1 character strings. It'd be nice to have inputstream.dart return int and List<int> and have tokenizer.dart consume those, not stringifying until ready to send tokens to the parser. Also, for character/space tokens it would be nice to preserve it even longer, and fix the treebuilder insertText code path

Incorrect spans generated for HTML with higher-plane unicode characters

When parsing HTML that includes characters like "🍋", the start and end FileLocations are generated incorrectly.

Here's a short repo:

import 'package:html/dom.dart';
import "package:html/parser.dart";
import "package:source_span/source_span.dart";

void main() {
  final dom = parse(contents,generateSpans: true);
  final Element element = dom.querySelectorAll("link").single;
  final span = element.sourceSpan;
  final spanCopy = new SourceSpan(span.start, span.end, contents);
}

const contents = """
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="alternate" type="application/rss+xml" title="ArtLung &raquo; Limones 🍋 Comments Feed" href="subdirectory/other.html" />
</head>
""";

This will throw the following error:

Unhandled exception:
Invalid argument(s): Text "<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="alternate" type="application/rss+xml" title="ArtLung &raquo; Limones 🍋 Comments Feed" href="subdirectory/other.html" />
</head>
" must be 130 characters long.
#0      new SourceSpanBase (package:source_span/src/span.dart:85:7)
#1      new SourceSpan (package:source_span/src/span.dart:34:11)
#2      main (file:///Users/filiph/dev/linkcheck/test/source_span_bug.dart:9:24)
#3      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:265)
#4      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)

This is not an issue with package:source_span — when I create the span manually, without parse(), copying it works okay.

querySelector return null if query with 2 classes

import 'package:html/parser.dart';
import 'package:html/dom.dart';

void main() {
  final doc = parse('<div class="aa bb"><div class="cc"><div/></div>');
  print(doc.querySelector('.aa.bb .cc'));
  }

*It works fine with .aa .cc

improving errors for unbalanced trees

<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="96" height="96"hspace="10"> Issue by sethladd
Originally opened as dart-lang/sdk#16695


(Moved from dart-lang/web-ui#­217)

These are a couple minor improvements we can do to give early feedback to our users:

when there is a mismatch close tag, show the location of the open-tag that wasn't closed correctly
when a component close tag is missing (either use a warning always, or at least if such component has no <content> tags in it)

fix strong mode analyzer issues

there are... a lot. thanks @devoncarew for finding these

evere: [InvalidMethodOverride] Invalid override. The type of FilteredElementList.contains ((Element) → bool) is not a subtype of Iterable<Element>.contains ((Object) → bool). (package:html/dom.dart, line 863, col 3)
severe: [InvalidMethodOverride] Invalid override. The type of FilteredElementList.contains ((Element) → bool) is not a subtype of ListMixin<Element>.contains ((Object) → bool). (package:html/dom.dart, line 863, col 3)
severe: [InvalidMethodOverride] Invalid override. The type of FilteredElementList.indexOf ((Element, [int]) → int) is not a subtype of ListMixin<Element>.indexOf ((Object, [int]) → int). (package:html/dom.dart, line 971, col 3)
severe: [InvalidMethodOverride] Invalid override. The type of FilteredElementList.lastIndexOf ((Element, [int]) → int) is not a subtype of ListMixin<Element>.lastIndexOf ((Object, [int]) → int). (package:html/dom.dart, line 974, col 3)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 822, col 53)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 878, col 16)
severe: [StaticTypeError] Type check failed: startTagHead(token) (void) is not of type Token (package:html/parser.dart, line 878, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 892, col 16)
severe: [StaticTypeError] Type check failed: endTagOther(token) (void) is not of type Token (package:html/parser.dart, line 892, col 16)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 897, col 50)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 906, col 50)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 921, col 50)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 926, col 50)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 944, col 16)
severe: [StaticTypeError] Type check failed: startTagTitle(token) (void) is not of type Token (package:html/parser.dart, line 944, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 948, col 16)
severe: [StaticTypeError] Type check failed: startTagNoScriptNoFramesStyle(token) (void) is not of type Token (package:html/parser.dart, line 948, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 950, col 16)
severe: [StaticTypeError] Type check failed: startTagScript(token) (void) is not of type Token (package:html/parser.dart, line 950, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 956, col 16)
severe: [StaticTypeError] Type check failed: startTagBaseLinkCommand(token) (void) is not of type Token (package:html/parser.dart, line 956, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 958, col 16)
severe: [StaticTypeError] Type check failed: startTagMeta(token) (void) is not of type Token (package:html/parser.dart, line 958, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 960, col 16)
severe: [StaticTypeError] Type check failed: startTagHead(token) (void) is not of type Token (package:html/parser.dart, line 960, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 969, col 16)
severe: [StaticTypeError] Type check failed: endTagHead(token) (void) is not of type Token (package:html/parser.dart, line 969, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 975, col 16)
severe: [StaticTypeError] Type check failed: endTagOther(token) (void) is not of type Token (package:html/parser.dart, line 975, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1078, col 16)
severe: [StaticTypeError] Type check failed: startTagBody(token) (void) is not of type Token (package:html/parser.dart, line 1078, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1080, col 16)
severe: [StaticTypeError] Type check failed: startTagFrameset(token) (void) is not of type Token (package:html/parser.dart, line 1080, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1090, col 16)
severe: [StaticTypeError] Type check failed: startTagFromHead(token) (void) is not of type Token (package:html/parser.dart, line 1090, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1092, col 16)
severe: [StaticTypeError] Type check failed: startTagHead(token) (void) is not of type Token (package:html/parser.dart, line 1092, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 1105, col 16)
severe: [StaticTypeError] Type check failed: endTagOther(token) (void) is not of type Token (package:html/parser.dart, line 1105, col 16)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 1167, col 56)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1198, col 16)
severe: [StaticTypeError] Type check failed: startTagBody(token) (void) is not of type Token (package:html/parser.dart, line 1198, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1200, col 16)
severe: [StaticTypeError] Type check failed: startTagFrameset(token) (void) is not of type Token (package:html/parser.dart, line 1200, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1224, col 16)
severe: [StaticTypeError] Type check failed: startTagCloseP(token) (void) is not of type Token (package:html/parser.dart, line 1224, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1232, col 16)
severe: [StaticTypeError] Type check failed: startTagHeading(token) (void) is not of type Token (package:html/parser.dart, line 1232, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1235, col 16)
severe: [StaticTypeError] Type check failed: startTagPreListing(token) (void) is not of type Token (package:html/parser.dart, line 1235, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1237, col 16)
severe: [StaticTypeError] Type check failed: startTagForm(token) (void) is not of type Token (package:html/parser.dart, line 1237, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1241, col 16)
severe: [StaticTypeError] Type check failed: startTagListItem(token) (void) is not of type Token (package:html/parser.dart, line 1241, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1243, col 16)
severe: [StaticTypeError] Type check failed: startTagPlaintext(token) (void) is not of type Token (package:html/parser.dart, line 1243, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1245, col 16)
severe: [StaticTypeError] Type check failed: startTagA(token) (void) is not of type Token (package:html/parser.dart, line 1245, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1258, col 16)
severe: [StaticTypeError] Type check failed: startTagFormatting(token) (void) is not of type Token (package:html/parser.dart, line 1258, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1260, col 16)
severe: [StaticTypeError] Type check failed: startTagNobr(token) (void) is not of type Token (package:html/parser.dart, line 1260, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1266, col 16)
severe: [StaticTypeError] Type check failed: startTagAppletMarqueeObject(token) (void) is not of type Token (package:html/parser.dart, line 1266, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1268, col 16)
severe: [StaticTypeError] Type check failed: startTagXmp(token) (void) is not of type Token (package:html/parser.dart, line 1268, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1270, col 16)
severe: [StaticTypeError] Type check failed: startTagTable(token) (void) is not of type Token (package:html/parser.dart, line 1270, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1277, col 16)
severe: [StaticTypeError] Type check failed: startTagVoidFormatting(token) (void) is not of type Token (package:html/parser.dart, line 1277, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1281, col 16)
severe: [StaticTypeError] Type check failed: startTagParamSource(token) (void) is not of type Token (package:html/parser.dart, line 1281, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1283, col 16)
severe: [StaticTypeError] Type check failed: startTagInput(token) (void) is not of type Token (package:html/parser.dart, line 1283, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1285, col 16)
severe: [StaticTypeError] Type check failed: startTagHr(token) (void) is not of type Token (package:html/parser.dart, line 1285, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1287, col 16)
severe: [StaticTypeError] Type check failed: startTagImage(token) (void) is not of type Token (package:html/parser.dart, line 1287, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1289, col 16)
severe: [StaticTypeError] Type check failed: startTagIsIndex(token) (void) is not of type Token (package:html/parser.dart, line 1289, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1291, col 16)
severe: [StaticTypeError] Type check failed: startTagTextarea(token) (void) is not of type Token (package:html/parser.dart, line 1291, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1293, col 16)
severe: [StaticTypeError] Type check failed: startTagIFrame(token) (void) is not of type Token (package:html/parser.dart, line 1293, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1297, col 16)
severe: [StaticTypeError] Type check failed: startTagRawtext(token) (void) is not of type Token (package:html/parser.dart, line 1297, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1299, col 16)
severe: [StaticTypeError] Type check failed: startTagSelect(token) (void) is not of type Token (package:html/parser.dart, line 1299, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1302, col 16)
severe: [StaticTypeError] Type check failed: startTagRpRt(token) (void) is not of type Token (package:html/parser.dart, line 1302, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1305, col 16)
severe: [StaticTypeError] Type check failed: startTagOpt(token) (void) is not of type Token (package:html/parser.dart, line 1305, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1307, col 16)
severe: [StaticTypeError] Type check failed: startTagMath(token) (void) is not of type Token (package:html/parser.dart, line 1307, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1309, col 16)
severe: [StaticTypeError] Type check failed: startTagSvg(token) (void) is not of type Token (package:html/parser.dart, line 1309, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 1321, col 16)
severe: [StaticTypeError] Type check failed: startTagMisplaced(token) (void) is not of type Token (package:html/parser.dart, line 1321, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 1330, col 16)
severe: [StaticTypeError] Type check failed: endTagBody(token) (void) is not of type Token (package:html/parser.dart, line 1330, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 1356, col 16)
severe: [StaticTypeError] Type check failed: endTagBlock(token) (void) is not of type Token (package:html/parser.dart, line 1356, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 1358, col 16)
severe: [StaticTypeError] Type check failed: endTagForm(token) (void) is not of type Token (package:html/parser.dart, line 1358, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 1360, col 16)
severe: [StaticTypeError] Type check failed: endTagP(token) (void) is not of type Token (package:html/parser.dart, line 1360, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 1364, col 16)
severe: [StaticTypeError] Type check failed: endTagListItem(token) (void) is not of type Token (package:html/parser.dart, line 1364, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 1372, col 16)
severe: [StaticTypeError] Type check failed: endTagHeading(token) (void) is not of type Token (package:html/parser.dart, line 1372, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 1391, col 16)
severe: [StaticTypeError] Type check failed: endTagAppletMarqueeObject(token) (void) is not of type Token (package:html/parser.dart, line 1391, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 1393, col 16)
severe: [StaticTypeError] Type check failed: endTagBr(token) (void) is not of type Token (package:html/parser.dart, line 1393, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 1395, col 16)
severe: [StaticTypeError] Type check failed: endTagOther(token) (void) is not of type Token (package:html/parser.dart, line 1395, col 16)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 1742, col 51)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 1743, col 54)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 1757, col 51)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 1860, col 51)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 2167, col 54)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 2202, col 40)
severe: [StaticTypeError] Type check failed: endTagScript(token) (void) is not of type Token (package:html/parser.dart, line 2202, col 40)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 2203, col 12)
severe: [StaticTypeError] Type check failed: endTagOther(token) (void) is not of type Token (package:html/parser.dart, line 2203, col 12)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 2243, col 16)
severe: [StaticTypeError] Type check failed: startTagCaption(token) (void) is not of type Token (package:html/parser.dart, line 2243, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 2245, col 16)
severe: [StaticTypeError] Type check failed: startTagColgroup(token) (void) is not of type Token (package:html/parser.dart, line 2245, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 2251, col 16)
severe: [StaticTypeError] Type check failed: startTagRowGroup(token) (void) is not of type Token (package:html/parser.dart, line 2251, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 2262, col 16)
severe: [StaticTypeError] Type check failed: startTagInput(token) (void) is not of type Token (package:html/parser.dart, line 2262, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 2264, col 16)
severe: [StaticTypeError] Type check failed: startTagForm(token) (void) is not of type Token (package:html/parser.dart, line 2264, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 2266, col 16)
severe: [StaticTypeError] Type check failed: startTagOther(token) (void) is not of type Token (package:html/parser.dart, line 2266, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 2273, col 16)
severe: [StaticTypeError] Type check failed: endTagTable(token) (void) is not of type Token (package:html/parser.dart, line 2273, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 2285, col 16)
severe: [StaticTypeError] Type check failed: endTagIgnore(token) (void) is not of type Token (package:html/parser.dart, line 2285, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 2287, col 16)
severe: [StaticTypeError] Type check failed: endTagOther(token) (void) is not of type Token (package:html/parser.dart, line 2287, col 16)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 2353, col 58)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 2364, col 55)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 2545, col 16)
severe: [StaticTypeError] Type check failed: endTagCaption(token) (void) is not of type Token (package:html/parser.dart, line 2545, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 2558, col 16)
severe: [StaticTypeError] Type check failed: endTagIgnore(token) (void) is not of type Token (package:html/parser.dart, line 2558, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 2644, col 16)
severe: [StaticTypeError] Type check failed: startTagCol(token) (void) is not of type Token (package:html/parser.dart, line 2644, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 2653, col 16)
severe: [StaticTypeError] Type check failed: endTagColgroup(token) (void) is not of type Token (package:html/parser.dart, line 2653, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 2655, col 16)
severe: [StaticTypeError] Type check failed: endTagCol(token) (void) is not of type Token (package:html/parser.dart, line 2655, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 2725, col 16)
severe: [StaticTypeError] Type check failed: startTagTr(token) (void) is not of type Token (package:html/parser.dart, line 2725, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 2746, col 16)
severe: [StaticTypeError] Type check failed: endTagTableRowGroup(token) (void) is not of type Token (package:html/parser.dart, line 2746, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 2757, col 16)
severe: [StaticTypeError] Type check failed: endTagIgnore(token) (void) is not of type Token (package:html/parser.dart, line 2757, col 16)
severe: [StaticTypeError] Type check failed: {} (Map<dynamic, dynamic>) is not of type LinkedHashMap<dynamic, String> (package:html/parser.dart, line 2799, col 46)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 2857, col 16)
severe: [StaticTypeError] Type check failed: startTagTableCell(token) (void) is not of type Token (package:html/parser.dart, line 2857, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 2874, col 16)
severe: [StaticTypeError] Type check failed: endTagTr(token) (void) is not of type Token (package:html/parser.dart, line 2874, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 2888, col 16)
severe: [StaticTypeError] Type check failed: endTagIgnore(token) (void) is not of type Token (package:html/parser.dart, line 2888, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 3012, col 16)
severe: [StaticTypeError] Type check failed: endTagTableCell(token) (void) is not of type Token (package:html/parser.dart, line 3012, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 3018, col 16)
severe: [StaticTypeError] Type check failed: endTagIgnore(token) (void) is not of type Token (package:html/parser.dart, line 3018, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 3112, col 16)
severe: [StaticTypeError] Type check failed: startTagOption(token) (void) is not of type Token (package:html/parser.dart, line 3112, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 3114, col 16)
severe: [StaticTypeError] Type check failed: startTagOptgroup(token) (void) is not of type Token (package:html/parser.dart, line 3114, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 3116, col 16)
severe: [StaticTypeError] Type check failed: startTagSelect(token) (void) is not of type Token (package:html/parser.dart, line 3116, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 3131, col 16)
severe: [StaticTypeError] Type check failed: endTagOption(token) (void) is not of type Token (package:html/parser.dart, line 3131, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 3133, col 16)
severe: [StaticTypeError] Type check failed: endTagOptgroup(token) (void) is not of type Token (package:html/parser.dart, line 3133, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 3135, col 16)
severe: [StaticTypeError] Type check failed: endTagSelect(token) (void) is not of type Token (package:html/parser.dart, line 3135, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 3137, col 16)
severe: [StaticTypeError] Type check failed: endTagOther(token) (void) is not of type Token (package:html/parser.dart, line 3137, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 3507, col 38)
severe: [StaticTypeError] Type check failed: endTagHtml(token) (void) is not of type Token (package:html/parser.dart, line 3507, col 38)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 3569, col 16)
severe: [StaticTypeError] Type check failed: startTagFrameset(token) (void) is not of type Token (package:html/parser.dart, line 3569, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 3571, col 16)
severe: [StaticTypeError] Type check failed: startTagFrame(token) (void) is not of type Token (package:html/parser.dart, line 3571, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 3582, col 16)
severe: [StaticTypeError] Type check failed: endTagFrameset(token) (void) is not of type Token (package:html/parser.dart, line 3582, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 3584, col 16)
severe: [StaticTypeError] Type check failed: endTagOther(token) (void) is not of type Token (package:html/parser.dart, line 3584, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 3656, col 16)
severe: [StaticTypeError] Type check failed: startTagOther(token) (void) is not of type Token (package:html/parser.dart, line 3656, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 3663, col 16)
severe: [StaticTypeError] Type check failed: endTagHtml(token) (void) is not of type Token (package:html/parser.dart, line 3663, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processEndTag' (package:html/parser.dart, line 3665, col 16)
severe: [StaticTypeError] Type check failed: endTagOther(token) (void) is not of type Token (package:html/parser.dart, line 3665, col 16)
severe: [AnalyzerMessage] The return type 'void' is not a 'Token', as defined by the method 'processStartTag' (package:html/parser.dart, line 3751, col 16)
severe: [StaticTypeError] Type check failed: startTagOther(token) (void) is not of type Token (package:html/parser.dart, line 3751, col 16)
severe: [InvalidMethodOverride] Invalid override. The type of CssClassSet.contains ((String) → bool) is not a subtype of Set<String>.contains ((Object) → bool). (package:html/src/css_class_set.dart, line 58, col 3)
severe: [InvalidMethodOverride] Invalid override. The type of CssClassSet.removeAll ((Iterable<String>) → void) is not a subtype of Set<String>.removeAll ((Iterable<Object>) → void). (package:html/src/css_class_set.dart, line 96, col 3)
severe: [InvalidMethodOverride] Invalid override. The type of CssClassSetImpl.lookup ((String) → String) is not a subtype of Set<String>.lookup ((Object) → String). (package:html/src/css_class_set.dart, line 190, col 3)
severe: [InvalidMethodOverride] Invalid override. The type of CssClassSetImpl.retainAll ((Iterable<String>) → void) is not a subtype of Set<String>.retainAll ((Iterable<Object>) → void). (package:html/src/css_class_set.dart, line 254, col 3)
severe: [InvalidMethodOverride] Invalid override. The type of CssClassSetImpl.containsAll ((Iterable<String>) → bool) is not a subtype of Set<String>.containsAll ((Iterable<Object>) → bool). (package:html/src/css_class_set.dart, line 266, col 3)
severe: [InvalidMethodOverride] Invalid override. The type of CssClassSetImpl.intersection ((Set<String>) → Set<String>) is not a subtype of Set<String>.intersection ((Set<Object>) → Set<String>). (package:html/src/css_class_set.dart, line 269, col 3)
severe: [InvalidMethodOverride] Invalid override. The type of CssClassSetImpl.firstWhere (((String) → bool, {orElse: () → Object}) → dynamic) is not a subtype of Iterable<String>.firstWhere (((String) → bool, {orElse: () → String}) → String). (package:html/src/css_class_set.dart, line 288, col 3)
severe: [InvalidMethodOverride] Invalid override. The type of CssClassSetImpl.lastWhere (((String) → bool, {orElse: () → Object}) → dynamic) is not a subtype of Iterable<String>.lastWhere (((String) → bool, {orElse: () → String}) → String). (package:html/src/css_class_set.dart, line 290, col 3)
severe: [InvalidMethodOverride] Invalid override. The type of ListProxy.remove ((E) → bool) is not a subtype of List<E>.remove ((Object) → bool). (package:html/src/list_proxy.dart, line 23, col 3)
severe: [InvalidMethodOverride] Invalid override. The type of ListProxy.setRange ((int, int, List<E>, [int]) → void) is not a subtype of List<E>.setRange ((int, int, Iterable<E>, [int]) → void). (package:html/src/list_proxy.dart, line 84, col 3)
severe: [AnalyzerMessage] A value of type 'void' cannot be assigned to a variable of type 'bool' (package:html/src/query_selector.dart, line 72, col 18)
severe: [StaticTypeError] Type check failed: s.simpleSelector.visit(this) (void) is not of type bool (package:html/src/query_selector.dart, line 72, col 18)
severe: [AnalyzerMessage] Negation argument must have a static type of 'bool' (package:html/src/query_selector.dart, line 78, col 39)
severe: [StaticTypeError] Type check failed: s.simpleSelector.visit(this) (void) is not of type bool (package:html/src/query_selector.dart, line 78, col 39)
severe: [AnalyzerMessage] Negation argument must have a static type of 'bool' (package:html/src/query_selector.dart, line 86, col 39)
severe: [StaticTypeError] Type check failed: s.simpleSelector.visit(this) (void) is not of type bool (package:html/src/query_selector.dart, line 86, col 39)
severe: [AnalyzerMessage] Negation argument must have a static type of 'bool' (package:html/src/query_selector.dart, line 244, col 10)
severe: [StaticTypeError] Type check failed: selector.nameAsSimpleSelector.visit(this) (void) is not of type bool (package:html/src/query_selector.dart, line 244, col 10)
severe: [AnalyzerMessage] Negation argument must have a static type of 'bool' (package:html/src/query_selector.dart, line 265, col 8)
severe: [StaticTypeError] Type check failed: selector.negationArg.visit(this) (void) is not of type bool (package:html/src/query_selector.dart, line 265, col 8)

Add support for sanitizing/filtering

<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="96" height="96"hspace="10"> Issue by sethladd
Originally opened as dart-lang/sdk#16694


I know that the readme talks about sanitizing being still unimplemented.

I made this task so that me and others can follow this particular work (couldn't find anything with the search).

We are using Web UI in our project and sometimes new SafeHtml.unsafe(...) even for user-supplied content which is bad, but we have to in order to support custom user-supplied HTML. Our hopes are that sooner or later we can replace those with code that sanitizes the bad input and makes sure it's clean by leveraging a whitelist approach.

publish a 0.13.3 version

@kevmoo, can you publish a new version of this? I'd like to capture the fix from #68. I believe the next version will be 0.13.3 - I updated the changelog to say such.

No span in "end-tag-too-early" error

Found this while fuzzing the angular analyzer.

<li><x</y><li>

The resulting ParseError "end-tag-too-early" contains no error span.

the lis seem to be important, though x, y, and if any of these tags have properties don't seem to be.

error getting attribute spans even though attributes exist on malformed html

I'm parsing this with quirks = true as document, and then trying to find the attributeSpans when the attributes map isn't empty.

This is the html:

<button attr<="value"></button>

this is the code:

     element.attributes.forEach((name, String value) {
      if (name is String) {
        String lowerName = name.toLowerCase();
        int nameOffset = element.attributeSpans[lowerName].start.offset;

and this is the error:

type 'ParseErrorToken' is not a subtype of type 'StartTagToken' in type cast where\n ParseErrorToken is from package:html/src/token.dart\n StartTagToken is from package:html/src/token.dart\n\n#0 Object._as (dart:core-patch/object_patch.dart:74)\n#1 Node._ensureAttributeSpans (package:html/dom.dart:286)\n#2 Node.attributeSpans (package:html/dom.dart:173)\n#3 HtmlTreeConverter._convertAttributes.<anonymous closure> (package:angular2_analyzer_plugin/src/resolver.dart:278)

At the time of error in the debugger

$ p attributes.length
= 1
$ p attributes['attr<']
= 'value'
$ p sourceSpan.text
= '<button attr<="value">'

and the current token is

Token _current = ParseErrorToken {  ⊟  
FileSpan span = _FileSpan {  ⊟  
final SourceFile file = SourceFile {  ⊞  }
final int _start = 0
final int _end = 13
}
StringBuffer _buffer = null
String _string = 'invalid-character-in-attribute-name'
Map messageParams = null
}

perf: avoid string concat

This bug appears to have been lost amongst the issue tracker moves. Basically, performance is bad in cases that force a lot of concatenation in the parser. This is a python-ism that did not translate well to Dart. We need to StringBuffer these, or keep as List for as long as possible.

getElementById does not support ids with point like "my.id"

As getElementById(id) is defined by :

Element getElementById(String id) => querySelector('#$id');

It doesn't work with ids like my.id because it is handled as finding an element with id my and class id.

A workaround is:

//var elmt = getElementById('my.id);
var elmt = querySelectorAll('[id]').firstWhere((e)=> e.id == 'my.id');

Incomplete HTML displaying errors incorrectly

Originally opened as dart-lang/sdk#16981

This issue was originally filed by [email protected]


With a structure with insufficient end div tags

e.g.

<html>
  <body>
    <div>
      <div>

      </div>
</body>

A warning is displayed associated with the /body tag below:

"web/....html:163:1: Unexpected end tag (div). Missing end tag (body)."

It should be reporting that there was a missing end tag for (div) instead. This made fixing the difficult slightly tricky.

The page used polymer.

dart:html compatible library

we should expose a library where interfaces are 100% dart:html compatible. It's fine if they throw unsupported, the important bit is to have full API compatibility. This allows code to be written that can work on either environment by simply swapping the import.

https://github.com/dart-lang/html/blob/master/lib/dom.dart isn't a bad start, but it has a ways to go.

Possibly quick idea to get started: reflect over dart:html using package:analyzer, and then dump the APIs. Use that as the starting point, then fill in the implementations where we can (everything related to parsing, DOM traversal, query selector, etc).

Hi, Can not work on gb2312

Please help, thanks

 const url = "http://www.ysts8.com/index_hot.html";
    var response = await get(url, headers: Utils.header);

    var html = parse(response.body, encoding: "gb2312");
    var tipsRoot = html.querySelector("div.pingshu_ysts8_i");
    var items = tipsRoot.querySelectorAll("li.qx");
    items.forEach((f) {
      print(f.text);
    });

dependencies

http: ^0.11.3+16
html: any

image

html5lib: full (or at least common) selector support

<img src="https://avatars.githubusercontent.com/u/1081711?v=3" align="left" width="96" height="96"hspace="10"> Issue by jmesserly
Originally opened as dart-lang/sdk#18508


only type (i.e. tag name) selectors are supported right now, e.g. "div"

most useful ones, IMHO

  • ids
  • classes
  • descendants
  • children
  • attributes

basically everything in simple selectors, other than psuedos:
http://www.w3.org/TR/css3-selectors/#simple-selectors

and the combinators, except sibling:
http://www.w3.org/TR/css3-selectors/#combinators

pull in html5tests via git submodule

one of the html5lib developers mentioned this on our old github repository. we can pull in the tests via submodule rather than checking in. The tests have seen a lot of updates in the 2+ years since my original port

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.