1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:47:45 +00:00

Everywhere: Behaviour => Behavior

This commit is contained in:
Andreas Kling 2021-09-07 12:56:50 +02:00
parent 55b0b06897
commit 6ad427993a
48 changed files with 120 additions and 120 deletions

View file

@ -547,7 +547,7 @@ extern "C" int vsscanf(const char* input, const char* format, va_list ap)
case ConversionSpecifier::Invalid:
case ConversionSpecifier::Unspecified:
default:
// "undefined behaviour", let's be nice and crash.
// "undefined behavior", let's be nice and crash.
dbgln("Invalid conversion specifier {} in scanf!", (int)conversion_specifier);
VERIFY_NOT_REACHED();
case ConversionSpecifier::Decimal:

View file

@ -241,7 +241,7 @@ ALWAYS_INLINE UnsignedBigInteger::Word UnsignedBigIntegerAlgorithms::shift_left_
VERIFY(num_bits <= UnsignedBigInteger::BITS_IN_WORD);
u32 result = 0;
// we need to check for "num_bits != 0" since shifting right by 32 is apparently undefined behaviour!
// we need to check for "num_bits != 0" since shifting right by 32 is apparently undefined behavior!
if (result_word_index > 0 && num_bits != 0) {
result += number.m_words[result_word_index - 1] >> (UnsignedBigInteger::BITS_IN_WORD - num_bits);
}

View file

@ -35,7 +35,7 @@ static constexpr float wrap(float value, GLint mode)
case GL_REPEAT:
return wrap_repeat(value);
// FIXME: These clamp modes actually have slightly different behaviour
// FIXME: These clamp modes actually have slightly different behavior
case GL_CLAMP:
case GL_CLAMP_TO_BORDER:
case GL_CLAMP_TO_EDGE:

View file

@ -1353,7 +1353,7 @@ void VimEditingEngine::put_after()
m_editor->set_cursor({ m_editor->cursor().line(), m_editor->current_line().first_non_whitespace_column() });
} else {
// FIXME: If attempting to put on the last column a line,
// the buffer will bne placed on the next line due to the move_one_left/right behaviour.
// the buffer will bne placed on the next line due to the move_one_left/right behavior.
move_one_right();
StringBuilder sb = StringBuilder(m_yank_buffer.length() * amount);
for (auto i = 0; i < amount; i++) {

View file

@ -104,7 +104,7 @@ bool Array::set_length(PropertyDescriptor const& property_descriptor)
// 15. Let succeeded be ! OrdinaryDefineOwnProperty(A, "length", newLenDesc).
// 16. If succeeded is false, return false.
// NOTE: Because the length property does not actually exist calling OrdinaryDefineOwnProperty
// will result in unintended behaviour, so instead we only implement here the small subset of
// will result in unintended behavior, so instead we only implement here the small subset of
// checks performed inside of it that would have mattered to us:
// 10.1.6.3 ValidateAndApplyPropertyDescriptor ( O, P, extensible, Desc, current ), https://tc39.es/ecma262/#sec-validateandapplypropertydescriptor

View file

@ -115,7 +115,7 @@ void iterator_close(Object& iterator)
auto& vm = iterator.vm();
auto& global_object = iterator.global_object();
// Emulates `completion` behaviour
// Emulates `completion` behavior
auto* completion_exception = vm.exception();
vm.clear_exception();
auto unwind_until = vm.unwind_until();

View file

@ -252,7 +252,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::repeat)
if (n == 0)
return js_string(vm, String::empty());
// NOTE: This is an optimization, it is not required by the specification but it produces equivalent behaviour
// NOTE: This is an optimization, it is not required by the specification but it produces equivalent behavior
if (string->is_empty())
return js_string(vm, String::empty());

View file

@ -173,7 +173,7 @@ Optional<ISODate> regulate_iso_date(GlobalObject& global_object, double year, do
// 3. If overflow is "reject", then
if (overflow == "reject"sv) {
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
// This does not change the exposed behaviour as the call to IsValidISODate will immediately check that these values are valid ISO
// This does not change the exposed behavior as the call to IsValidISODate will immediately check that these values are valid ISO
// values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31) all of which are subsets of this check.
if (!AK::is_within_range<i32>(year) || !AK::is_within_range<u8>(month) || !AK::is_within_range<u8>(day)) {
vm.throw_exception<RangeError>(global_object, ErrorType::TemporalInvalidPlainDate);
@ -193,7 +193,7 @@ Optional<ISODate> regulate_iso_date(GlobalObject& global_object, double year, do
// 4. If overflow is "constrain", then
else if (overflow == "constrain"sv) {
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat this double as normal integer from this point onwards. This
// does not change the exposed behaviour as the parent's call to CreateTemporalDate will immediately check that this value is a valid
// does not change the exposed behavior as the parent's call to CreateTemporalDate will immediately check that this value is a valid
// ISO value for years: -273975 - 273975, which is a subset of this check.
if (!AK::is_within_range<i32>(year)) {
vm.throw_exception<RangeError>(global_object, ErrorType::TemporalInvalidPlainDate);

View file

@ -73,7 +73,7 @@ Value PlainDateConstructor::construct(FunctionObject& new_target)
return {};
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
// This does not change the exposed behaviour as the call to CreateTemporalDate will immediately check that these values are valid
// This does not change the exposed behavior as the call to CreateTemporalDate will immediately check that these values are valid
// ISO values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31) all of which are subsets of this check.
if (!AK::is_within_range<i32>(y) || !AK::is_within_range<u8>(m) || !AK::is_within_range<u8>(d)) {
vm.throw_exception<RangeError>(global_object, ErrorType::TemporalInvalidPlainDate);

View file

@ -103,7 +103,7 @@ Value PlainDateTimeConstructor::construct(FunctionObject& new_target)
return {};
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
// This does not change the exposed behaviour as the call to CreateTemporalDateTime will immediately check that these values are valid
// This does not change the exposed behavior as the call to CreateTemporalDateTime will immediately check that these values are valid
// ISO values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31, for hours: 0 - 23, for minutes and seconds: 0 - 59,
// milliseconds, microseconds, and nanoseconds: 0 - 999) all of which are subsets of this check.
if (!AK::is_within_range<i32>(iso_year) || !AK::is_within_range<u8>(iso_month) || !AK::is_within_range<u8>(iso_day) || !AK::is_within_range<u8>(hour) || !AK::is_within_range<u8>(minute) || !AK::is_within_range<u8>(second) || !AK::is_within_range<u16>(millisecond) || !AK::is_within_range<u16>(microsecond) || !AK::is_within_range<u16>(nanosecond)) {

View file

@ -78,7 +78,7 @@ Value PlainMonthDayConstructor::construct(FunctionObject& new_target)
return {};
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
// This does not change the exposed behaviour as the call to CreateTemporalMonthDay will immediately check that these values are valid
// This does not change the exposed behavior as the call to CreateTemporalMonthDay will immediately check that these values are valid
// ISO values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31) all of which are subsets of this check.
if (!AK::is_within_range<i32>(ref) || !AK::is_within_range<u8>(m) || !AK::is_within_range<u8>(d)) {
vm.throw_exception<RangeError>(global_object, ErrorType::TemporalInvalidPlainYearMonth);

View file

@ -81,7 +81,7 @@ Value PlainTimeConstructor::construct(FunctionObject& new_target)
return {};
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
// This does not change the exposed behaviour as the call to CreateTemporalTime will immediately check that these values are valid
// This does not change the exposed behavior as the call to CreateTemporalTime will immediately check that these values are valid
// ISO values (for hours: 0 - 23, for minutes and seconds: 0 - 59, milliseconds, microseconds, and nanoseconds: 0 - 999) all of which
// are subsets of this check.
if (!AK::is_within_range<u8>(hour) || !AK::is_within_range<u8>(minute) || !AK::is_within_range<u8>(second) || !AK::is_within_range<u16>(millisecond) || !AK::is_within_range<u16>(microsecond) || !AK::is_within_range<u16>(nanosecond)) {

View file

@ -44,7 +44,7 @@ Optional<ISOYearMonth> regulate_iso_year_month(GlobalObject& global_object, doub
// 3. If overflow is "constrain", then
if (overflow == "constrain"sv) {
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat `year` (a double) as normal integer from this point onwards.
// This does not change the exposed behaviour as the subsequent call to CreateTemporalYearMonth will check that its value is a valid ISO
// This does not change the exposed behavior as the subsequent call to CreateTemporalYearMonth will check that its value is a valid ISO
// values (for years: -273975 - 273975) which is a subset of this check.
// If RegulateISOYearMonth is ever used outside ISOYearMonthFromFields, this may need to be changed.
if (!AK::is_within_range<i32>(year)) {
@ -59,7 +59,7 @@ Optional<ISOYearMonth> regulate_iso_year_month(GlobalObject& global_object, doub
// 4. If overflow is "reject", then
if (overflow == "reject"sv) {
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
// This does not change the exposed behaviour as the call to IsValidISOMonth and subsequent call to CreateTemporalDateTime will check
// This does not change the exposed behavior as the call to IsValidISOMonth and subsequent call to CreateTemporalDateTime will check
// that these values are valid ISO values (for years: -273975 - 273975, for months: 1 - 12) all of which are subsets of this check.
if (!AK::is_within_range<i32>(year) || !AK::is_within_range<u8>(month)) {
vm.throw_exception<RangeError>(global_object, ErrorType::TemporalInvalidPlainYearMonth);

View file

@ -78,7 +78,7 @@ Value PlainYearMonthConstructor::construct(FunctionObject& new_target)
return {};
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
// This does not change the exposed behaviour as the call to CreateTemporalYearMonth will immediately check that these values are valid
// This does not change the exposed behavior as the call to CreateTemporalYearMonth will immediately check that these values are valid
// ISO values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31) all of which are subsets of this check.
if (!AK::is_within_range<i32>(y) || !AK::is_within_range<u8>(m) || !AK::is_within_range<u8>(ref)) {
vm.throw_exception<RangeError>(global_object, ErrorType::TemporalInvalidPlainYearMonth);

View file

@ -22,7 +22,7 @@ test("length is 2", () => {
});
});
describe("normal behaviour", () => {
describe("normal behavior", () => {
test("Noop", () => {
TYPED_ARRAYS.forEach(T => {
const array = new T([1, 2]);
@ -37,7 +37,7 @@ describe("normal behaviour", () => {
});
});
test("basic behaviour", () => {
test("basic behavior", () => {
TYPED_ARRAYS.forEach(T => {
const array = new T([1, 2, 3]);
expect(array.copyWithin(1, 2)).toEqual(array);

View file

@ -112,7 +112,7 @@ describe("errors", () => {
});
});
describe("normal behaviour", () => {
describe("normal behavior", () => {
test("never calls callback with empty array", () => {
TYPED_ARRAYS.forEach(T => {
let callbackCalled = 0;

View file

@ -44,7 +44,7 @@ describe("errors", () => {
BIGINT_TYPED_ARRAYS.forEach(T => errorTests(T));
});
describe("normal behaviour", () => {
describe("normal behavior", () => {
test("basic functionality", () => {
TYPED_ARRAYS.forEach(T => {
const typedArray = new T([1, 2, 3]);

View file

@ -44,7 +44,7 @@ describe("errors", () => {
BIGINT_TYPED_ARRAYS.forEach(T => errorTests(T));
});
describe("normal behaviour", () => {
describe("normal behavior", () => {
test("basic functionality", () => {
TYPED_ARRAYS.forEach(T => {
const typedArray = new T([1, 2, 3]);

View file

@ -44,7 +44,7 @@ describe("errors", () => {
BIGINT_TYPED_ARRAYS.forEach(T => errorTests(T));
});
describe("normal behaviour", () => {
describe("normal behavior", () => {
test("basic functionality", () => {
TYPED_ARRAYS.forEach(T => {
const typedArray = new T([1, 2, 3]);

View file

@ -44,7 +44,7 @@ describe("errors", () => {
BIGINT_TYPED_ARRAYS.forEach(T => errorTests(T));
});
describe("normal behaviour", () => {
describe("normal behavior", () => {
test("basic functionality", () => {
TYPED_ARRAYS.forEach(T => {
const typedArray = new T([1, 2, 3]);

View file

@ -44,7 +44,7 @@ describe("errors", () => {
BIGINT_TYPED_ARRAYS.forEach(T => errorTests(T));
});
describe("normal behaviour", () => {
describe("normal behavior", () => {
test("never calls callback with empty array", () => {
function emptyTest(T) {
var callbackCalled = 0;

View file

@ -144,7 +144,7 @@ describe("errors", () => {
});
});
describe("normal behaviour", () => {
describe("normal behavior", () => {
test("never calls callback with empty array", () => {
TYPED_ARRAYS.forEach(T => {
let callbackCalled = 0;

View file

@ -41,11 +41,11 @@ Configuration Configuration::from_config(const StringView& libname)
Configuration configuration;
auto config_file = Core::ConfigFile::open_for_lib(libname);
// Read behaviour options.
auto refresh = config_file->read_entry("behaviour", "refresh", "lazy");
auto operation = config_file->read_entry("behaviour", "operation_mode");
auto bracketed_paste = config_file->read_bool_entry("behaviour", "bracketed_paste", true);
auto default_text_editor = config_file->read_entry("behaviour", "default_text_editor");
// Read behavior options.
auto refresh = config_file->read_entry("behavior", "refresh", "lazy");
auto operation = config_file->read_entry("behavior", "operation_mode");
auto bracketed_paste = config_file->read_bool_entry("behavior", "bracketed_paste", true);
auto default_text_editor = config_file->read_entry("behavior", "default_text_editor");
Configuration::Flags flags { Configuration::Flags::None };
if (bracketed_paste)
@ -184,7 +184,7 @@ void Editor::set_default_keybinds()
Editor::Editor(Configuration configuration)
: m_configuration(move(configuration))
{
m_always_refresh = m_configuration.refresh_behaviour == Configuration::RefreshBehaviour::Eager;
m_always_refresh = m_configuration.refresh_behavior == Configuration::RefreshBehavior::Eager;
m_pending_chars = {};
get_terminal_size();
m_suggestion_display = make<XtermSuggestionDisplay>(m_num_lines, m_num_columns);
@ -1024,8 +1024,8 @@ void Editor::handle_read_event()
ArmedScopeGuard suggestion_cleanup { [this] { cleanup_suggestions(); } };
// Normally ^D. `stty eof \^n` can change it to ^N (or something else), but Serenity doesn't have `stty` yet.
// Process this here since the keybinds might override its behaviour.
// This only applies when the buffer is empty. at any other time, the behaviour should be configurable.
// Process this here since the keybinds might override its behavior.
// This only applies when the buffer is empty. at any other time, the behavior should be configurable.
if (code_point == m_termios.c_cc[VEOF] && m_buffer.size() == 0) {
finish_edit();
continue;

View file

@ -45,7 +45,7 @@ struct KeyBinding {
};
struct Configuration {
enum RefreshBehaviour {
enum RefreshBehavior {
Lazy,
Eager,
};
@ -80,7 +80,7 @@ struct Configuration {
set(arg);
}
void set(RefreshBehaviour refresh) { refresh_behaviour = refresh; }
void set(RefreshBehavior refresh) { refresh_behavior = refresh; }
void set(OperationMode mode) { operation_mode = mode; }
void set(SignalHandler mode) { m_signal_mode = mode; }
void set(const KeyBinding& binding) { keybindings.append(binding); }
@ -92,7 +92,7 @@ struct Configuration {
static Configuration from_config(const StringView& libname = "line");
RefreshBehaviour refresh_behaviour { RefreshBehaviour::Lazy };
RefreshBehavior refresh_behavior { RefreshBehavior::Lazy };
SignalHandler m_signal_mode { SignalHandler::WithSignalHandlers };
OperationMode operation_mode { OperationMode::Unset };
Vector<KeyBinding> keybindings;

View file

@ -34,7 +34,7 @@ enum class AllFlags {
Multiline = __Regex_Multiline, // Handle newline characters. Match each line, one by one.
SkipTrimEmptyMatches = __Regex_SkipTrimEmptyMatches, // Do not remove empty capture group results.
Internal_Stateful = __Regex_Internal_Stateful, // Make global matches match one result at a time, and further match() calls on the same instance continue where the previous one left off.
Internal_BrowserExtended = __Regex_Internal_BrowserExtended, // Only for ECMA262, Enable the behaviours defined in section B.1.4. of the ECMA262 spec.
Internal_BrowserExtended = __Regex_Internal_BrowserExtended, // Only for ECMA262, Enable the behaviors defined in section B.1.4. of the ECMA262 spec.
Last = Internal_BrowserExtended,
};

View file

@ -260,7 +260,7 @@ private:
// Most patterns should have no need to ever populate this field.
Optional<size_t> m_total_number_of_capturing_parenthesis;
// Keep the Annex B. behaviour behind a flag, the users can enable it by passing the `ECMAScriptFlags::BrowserExtended` flag.
// Keep the Annex B. behavior behind a flag, the users can enable it by passing the `ECMAScriptFlags::BrowserExtended` flag.
bool m_should_use_browser_extended_grammar { false };
// ECMA-262 basically requires that we clear the inner captures of a capture group before trying to match it,

View file

@ -307,7 +307,7 @@ template<typename V, typename T>
MakeSigned<T> BytecodeInterpreter::checked_signed_truncate(V value)
{
if (isnan(value) || isinf(value)) { // "undefined", let's just trap.
m_trap = Trap { "Signed truncation undefined behaviour" };
m_trap = Trap { "Signed truncation undefined behavior" };
return 0;
}
@ -330,7 +330,7 @@ template<typename V, typename T>
MakeUnsigned<T> BytecodeInterpreter::checked_unsigned_truncate(V value)
{
if (isnan(value) || isinf(value)) { // "undefined", let's just trap.
m_trap = Trap { "Unsigned truncation undefined behaviour" };
m_trap = Trap { "Unsigned truncation undefined behavior" };
return 0;
}
double truncated;

View file

@ -317,7 +317,7 @@ struct CheckedTruncate {
AK::Result<ResultT, StringView> operator()(Lhs lhs) const
{
if (isnan(lhs) || isinf(lhs)) // "undefined", let's just trap.
return "Truncation undefined behaviour"sv;
return "Truncation undefined behavior"sv;
Lhs truncated;
if constexpr (IsSame<float, Lhs>)

View file

@ -181,7 +181,7 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr<
bool is_activation_event = is<UIEvents::MouseEvent>(*event) && event->type() == HTML::EventNames::click;
if (is_activation_event && target->activation_behaviour)
if (is_activation_event && target->activation_behavior)
activation_target = target;
// FIXME: Let slottable be target, if target is a slottable and is assigned, and null otherwise.
@ -203,7 +203,7 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr<
if (is<Window>(parent)
|| (is<Node>(parent) && verify_cast<Node>(*target).root().is_shadow_including_inclusive_ancestor_of(verify_cast<Node>(*parent)))) {
if (is_activation_event && event->bubbles() && !activation_target && parent->activation_behaviour)
if (is_activation_event && event->bubbles() && !activation_target && parent->activation_behavior)
activation_target = parent;
event->append_to_path(*parent, nullptr, related_target, touch_targets, slot_in_closed_tree);
@ -212,7 +212,7 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr<
} else {
target = *parent;
if (is_activation_event && !activation_target && target->activation_behaviour)
if (is_activation_event && !activation_target && target->activation_behavior)
activation_target = target;
event->append_to_path(*parent, target, related_target, touch_targets, slot_in_closed_tree);
@ -255,8 +255,8 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr<
}
}
if (activation_target && activation_target->legacy_pre_activation_behaviour)
activation_target->legacy_pre_activation_behaviour();
if (activation_target && activation_target->legacy_pre_activation_behavior)
activation_target->legacy_pre_activation_behavior();
for (ssize_t i = event->path().size() - 1; i >= 0; --i) {
auto& entry = event->path().at(i);
@ -298,11 +298,11 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr<
if (activation_target) {
if (!event->cancelled()) {
// NOTE: Since activation_target is set, it will have activation behaviour.
activation_target->activation_behaviour(event);
// NOTE: Since activation_target is set, it will have activation behavior.
activation_target->activation_behavior(event);
} else {
if (activation_target->legacy_cancelled_activation_behaviour)
activation_target->legacy_cancelled_activation_behaviour();
if (activation_target->legacy_cancelled_activation_behavior)
activation_target->legacy_cancelled_activation_behavior();
}
}

View file

@ -47,11 +47,11 @@ public:
Vector<EventListenerRegistration>& listeners() { return m_listeners; }
const Vector<EventListenerRegistration>& listeners() const { return m_listeners; }
Function<void(const Event&)> activation_behaviour;
Function<void(const Event&)> activation_behavior;
// NOTE: These only exist for checkbox and radio input elements.
Function<void()> legacy_pre_activation_behaviour;
Function<void()> legacy_cancelled_activation_behaviour;
Function<void()> legacy_pre_activation_behavior;
Function<void()> legacy_cancelled_activation_behavior;
protected:
explicit EventTarget(Bindings::ScriptExecutionContext&);

View file

@ -27,7 +27,7 @@ namespace AttributeNames {
__ENUMERATE_HTML_ATTRIBUTE(autoplay) \
__ENUMERATE_HTML_ATTRIBUTE(axis) \
__ENUMERATE_HTML_ATTRIBUTE(background) \
__ENUMERATE_HTML_ATTRIBUTE(behaviour) \
__ENUMERATE_HTML_ATTRIBUTE(behavior) \
__ENUMERATE_HTML_ATTRIBUTE(bgcolor) \
__ENUMERATE_HTML_ATTRIBUTE(border) \
__ENUMERATE_HTML_ATTRIBUTE(cellpadding) \

View file

@ -1,6 +1,6 @@
interface HTMLMarqueeElement : HTMLElement {
[Reflect] attribute DOMString behaviour;
[Reflect] attribute DOMString behavior;
[Reflect=bgcolor] attribute DOMString bgColor;
[Reflect] attribute DOMString direction;
[Reflect] attribute DOMString height;