Table of Contents

Class BaseInputType

Namespace
AngleSharp.Html.InputTypes
Assembly
AngleSharp.dll

Base type for the all input field types. Primarily from: http://www.w3.org/TR/html5/forms.html#range-state-(type=range)

public abstract class BaseInputType
Inheritance
BaseInputType
Inherited Members
Extension Methods

Constructors

BaseInputType(IHtmlInputElement, string, bool)

Creates a new base input type.

public BaseInputType(IHtmlInputElement input, string name, bool validate)

Parameters

input IHtmlInputElement
name string
validate bool

Fields

NumberPattern

Simple regular expression for floating point numbers.

protected static readonly Regex NumberPattern

Field Value

Regex

UnixEpoch

The start of the unix epoch (1st of January 1970).

protected static readonly DateTime UnixEpoch

Field Value

DateTime

Properties

CanBeValidated

Gets if the input type can be validated.

public bool CanBeValidated { get; }

Property Value

bool

Input

Gets the associated input element.

public IHtmlInputElement Input { get; }

Property Value

IHtmlInputElement

Name

Gets the name of the input type.

public string Name { get; }

Property Value

string

Methods

Check(IValidityState)

Checks the current input for its validity.

public virtual ValidationErrors Check(IValidityState current)

Parameters

current IValidityState

Returns

ValidationErrors

CheckTime(IValidityState, string, DateTime?, DateTime?, DateTime?)

Validates the time using the given parameters.

protected ValidationErrors CheckTime(IValidityState state, string value, DateTime? date, DateTime? min, DateTime? max)

Parameters

state IValidityState
value string
date DateTime?
min DateTime?
max DateTime?

Returns

ValidationErrors

ConstructDataSet(FormDataSet)

Populates the form data set with the current input.

public virtual void ConstructDataSet(FormDataSet dataSet)

Parameters

dataSet FormDataSet

ConvertFromDate(DateTime)

Tries to convert the given date time to a string.

public virtual string ConvertFromDate(DateTime value)

Parameters

value DateTime

Returns

string

ConvertFromNumber(double)

Tries to convert the given number to a string.

public virtual string ConvertFromNumber(double value)

Parameters

value double

Returns

string

ConvertToDate(string)

Tries to convert the given string to a date time.

public virtual DateTime? ConvertToDate(string value)

Parameters

value string

Returns

DateTime?

ConvertToNumber(string?)

Tries to convert the given string to a number.

public virtual double? ConvertToNumber(string? value)

Parameters

value string

Returns

double?

DoStep(int)

Changes the value by n steps.

public virtual void DoStep(int n)

Parameters

n int

FetchDigits(string)

Skips all legit digits while returning the final position.

protected static int FetchDigits(string value)

Parameters

value string

Returns

int

GetDefaultStep()

Gets the default step size.

protected virtual double GetDefaultStep()

Returns

double

GetDefaultStepBase()

Gets the default step offset.

protected virtual double GetDefaultStepBase()

Returns

double

GetErrorsFrom(IValidityState)

Converts the given validity state to a validation error enum.

protected static ValidationErrors GetErrorsFrom(IValidityState state)

Parameters

state IValidityState

Returns

ValidationErrors

GetStep()

Gets the current step size.

protected double GetStep()

Returns

double

GetStepScaleFactor()

Gets the step scaling factor.

protected virtual double GetStepScaleFactor()

Returns

double

GetWeekOfYear(DateTime)

Tries to convert the value to a week.

protected static int GetWeekOfYear(DateTime value)

Parameters

value DateTime

Returns

int

IsAppendingData(IHtmlElement)

Checks if the given type wants to append data.

public virtual bool IsAppendingData(IHtmlElement submitter)

Parameters

submitter IHtmlElement

Returns

bool

IsInvalidPattern(string?, string?)

Checks if the string does not follow the pattern.

protected static bool IsInvalidPattern(string? pattern, string? value)

Parameters

pattern string
value string

Returns

bool

IsLegalDay(int, int, int)

Checks if the given values form a legal date.

protected static bool IsLegalDay(int day, int month, int year)

Parameters

day int
month int
year int

Returns

bool

IsLegalHour(int)

Checks if the given value is a legal hour.

protected static bool IsLegalHour(int value)

Parameters

value int

Returns

bool

IsLegalMinute(int)

Checks if the given value is a legal minute.

protected static bool IsLegalMinute(int value)

Parameters

value int

Returns

bool

IsLegalMonth(int)

Checks if the given value is a legal month.

protected static bool IsLegalMonth(int value)

Parameters

value int

Returns

bool

IsLegalSecond(int)

Checks if the given value is a legal second.

protected static bool IsLegalSecond(int value)

Parameters

value int

Returns

bool

IsLegalWeek(int, int)

Checks if the given values form a legal week.

protected static bool IsLegalWeek(int week, int year)

Parameters

week int
year int

Returns

bool

IsLegalYear(int)

Checks if the given value is a legal year.

protected static bool IsLegalYear(int value)

Parameters

value int

Returns

bool

IsStepMismatch()

Checks if the current value does not match the steps.

protected bool IsStepMismatch()

Returns

bool

IsTimeSeparator(char)

Checks if the given character is a valid time separator.

protected static bool IsTimeSeparator(char chr)

Parameters

chr char

Returns

bool

PositionIsValidForDateTime(string, int)

Checks the assumption that the string continues with a date time.

protected static bool PositionIsValidForDateTime(string value, int position)

Parameters

value string
position int

Returns

bool

ToNumber(string?)

Tries to convert the value to a number using the default expression.

protected static double? ToNumber(string? value)

Parameters

value string

Returns

double?

ToTime(string, ref int)

Tries to convert the value to a time starting at the given position.

protected static TimeSpan? ToTime(string value, ref int position)

Parameters

value string
position int

Returns

TimeSpan?