一、Input 类型: tel
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
</head>
<body>
<form action="demo-form.php">
电话号码: <input type="tel" name="usrtel"><br>
<input type="submit">
</form>
</body>
</html>
二、tel c++接口定义:
third_party\blink\renderer\core\html\forms\telephone_input_type.h
third_party\blink\renderer\core\html\forms\telephone_input_type.cc
namespace blink {
class TelephoneInputType final : public BaseTextInputType {
public:
explicit TelephoneInputType(HTMLInputElement& element)
: BaseTextInputType(Type::kTelephone, element) {}
private:
void CountUsage() override;
};
template <>
struct DowncastTraits<TelephoneInputType> {
static bool AllowFrom(const InputType& type) {
return type.IsTelephoneInputType();
}
};
} // namespace blink