1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:27:35 +00:00

LibWeb: Teach HTMLTokenizer how to tokenize attributes

Properly tokenize single-quoted, double-quoted and unquoted attributes!
This commit is contained in:
Andreas Kling 2020-05-23 01:19:42 +02:00
parent daf74838dd
commit 6caa5661f3
3 changed files with 232 additions and 5 deletions

View file

@ -30,7 +30,6 @@
#include <AK/StringBuilder.h>
#include <AK/Types.h>
#include <AK/Vector.h>
#include <LibWeb/DOM/Attribute.h>
namespace Web {
@ -50,6 +49,11 @@ public:
Type type() const { return m_type; }
private:
struct AttributeBuilder {
StringBuilder name_builder;
StringBuilder value_builder;
};
Type m_type;
// Type::DOCTYPE
@ -65,7 +69,7 @@ private:
struct {
StringBuilder tag_name;
bool self_closing { false };
Vector<Attribute> attributes;
Vector<AttributeBuilder> attributes;
} m_tag;
// Type::Comment