Browse Source

前置知识,paser5,日期,约束,视口。

jxq 5 months ago
commit
2f80cfe430

+ 8 - 0
.idea/.gitignore

@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 28 - 0
.idea/inspectionProfiles/Project_Default.xml

@@ -0,0 +1,28 @@
+<component name="InspectionProjectProfileManager">
+  <profile version="1.0">
+    <option name="myName" value="Project Default" />
+    <inspection_tool class="HtmlUnknownAttribute" enabled="false" level="WARNING" enabled_by_default="false">
+      <option name="myValues">
+        <value>
+          <list size="0" />
+        </value>
+      </option>
+      <option name="myCustomValuesEnabled" value="true" />
+    </inspection_tool>
+    <inspection_tool class="HtmlUnknownTag" enabled="false" level="WARNING" enabled_by_default="false">
+      <option name="myValues">
+        <value>
+          <list size="6">
+            <item index="0" class="java.lang.String" itemvalue="nobr" />
+            <item index="1" class="java.lang.String" itemvalue="noembed" />
+            <item index="2" class="java.lang.String" itemvalue="comment" />
+            <item index="3" class="java.lang.String" itemvalue="noscript" />
+            <item index="4" class="java.lang.String" itemvalue="embed" />
+            <item index="5" class="java.lang.String" itemvalue="script" />
+          </list>
+        </value>
+      </option>
+      <option name="myCustomValuesEnabled" value="true" />
+    </inspection_tool>
+  </profile>
+</component>

+ 19 - 0
.idea/misc.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectInspectionProfilesVisibleTreeState">
+    <entry key="Project Default">
+      <profile-state>
+        <expanded-state>
+          <State>
+            <id>HTML</id>
+          </State>
+        </expanded-state>
+        <selected-state>
+          <State>
+            <id>HtmlUnknownAttribute</id>
+          </State>
+        </selected-state>
+      </profile-state>
+    </entry>
+  </component>
+</project>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/training-web.iml" filepath="$PROJECT_DIR$/.idea/training-web.iml" />
+    </modules>
+  </component>
+</project>

+ 7 - 0
.idea/prettier.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="PrettierConfiguration">
+    <option name="myConfigurationMode" value="AUTOMATIC" />
+    <option name="myRunOnSave" value="true" />
+  </component>
+</project>

+ 12 - 0
.idea/training-web.iml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$">
+      <excludeFolder url="file://$MODULE_DIR$/.tmp" />
+      <excludeFolder url="file://$MODULE_DIR$/temp" />
+      <excludeFolder url="file://$MODULE_DIR$/tmp" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>

+ 0 - 0
Pre-Knowledge.md


+ 0 - 0
README.md


+ 16 - 0
package.json

@@ -0,0 +1,16 @@
+{
+  "name": "training-web",
+  "version": "1.0.0",
+  "description": "",
+  "main": "index.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "keywords": [],
+  "author": "",
+  "license": "ISC",
+  "packageManager": "pnpm@10.6.2",
+  "dependencies": {
+    "parse5": "^7.3.0"
+  }
+}

+ 9 - 0
pase5.js

@@ -0,0 +1,9 @@
+console.log("dddd", 1111)
+const parse5 = require('parse5');
+
+// 解析 HTML 字符串
+const document = parse5.parse('<!DOCTYPE html><html><head></head><body>Hi there!</body></html>');
+
+// 序列化文档
+const html = parse5.serialize(document);
+console.log(html);

+ 30 - 0
pnpm-lock.yaml

@@ -0,0 +1,30 @@
+lockfileVersion: '9.0'
+
+settings:
+  autoInstallPeers: true
+  excludeLinksFromLockfile: false
+
+importers:
+
+  .:
+    dependencies:
+      parse5:
+        specifier: ^7.3.0
+        version: 7.3.0
+
+packages:
+
+  entities@6.0.1:
+    resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==}
+    engines: {node: '>=0.12'}
+
+  parse5@7.3.0:
+    resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==}
+
+snapshots:
+
+  entities@6.0.1: {}
+
+  parse5@7.3.0:
+    dependencies:
+      entities: 6.0.1

+ 0 - 0
心得体会.md


+ 30 - 0
日期与时间格式.html

@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+</head>
+<body>
+    <input type="date"/>
+    <input type="time"/>
+    <input type="month"/>
+     <input type="datetime-local"/>
+<input type="email"/>
+<input type="number"/>
+<input type="password"/>
+<input type="search"/>
+<input type="tel"/>
+<input type="text"/>
+<input type="url"/>
+<input type="range"/>
+<input type="image"/>
+<input type="reset"/>
+<input type="submit"/>
+<input type="button" value="Button"/>
+<input type="color"/>
+<input type="checkbox"/>
+
+
+</body>
+</html>

+ 55 - 0
约束验证.html

@@ -0,0 +1,55 @@
+<!doctype html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Document</title>
+    <style>
+        input:required {
+            border: 1px solid red;
+        }
+    </style>
+</head>
+<body>
+<input type="email" id="email" placeholder="Email" title="dddd" required>
+<br/>
+<label for="FS">选择一个小于 75 kB 的文件:</label>
+<input type="file" id="FS" />
+<input type="text" id="function" onchange="onInputChange()"/>
+<script>
+    var email = document.getElementById('email');
+    email.addEventListener("blur", function (event) {
+        if (email.validity && !email.validity.valid) {
+            event.preventDefault();
+            email.setCustomValidity("Please enter a valid email address.")
+            // alert("Please enter a valid email address.");
+        }
+    })
+
+    function checkFileSize() {
+        const FS = document.getElementById("FS");
+        const files = FS.files;
+
+        // 如果选择了(至少)一个文件
+        if (files.length > 0) {
+            if (files[0].size > 2 ) {
+                // 检查约束条件
+                alert("文件大小不能超过 75 kB")
+                console.log(FS.setCustomValidity("文件大小不能超过 75 kB"));
+
+            }
+        }
+        // 没有违反自定义约束条件
+        FS.setCustomValidity("");
+    }
+
+    let fileEle = document.getElementById('FS');
+    fileEle.addEventListener('change', checkFileSize, false);
+
+    function onInputChange(e) {
+        console.log("onInputChange", e)
+    }
+
+</script>
+</body>
+</html>

+ 12 - 0
视口.html

@@ -0,0 +1,12 @@
+<!doctype html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="minWidth=700, height=200, initial-scale=1">
+    <title>Document</title>
+</head>
+<body style="border: 1px solid red">
+meta标签里面的内容,主要是提供关于这个HTML页面的元信息的。
+meta标签更常见的是这种name + content的形式:
+</body>
+</html>