Commit d0ba328e authored by darin's avatar darin

JavaScriptCore:

	- next step towards atomic identifiers; Identifier is no longer derived from UString

        * kjs/identifier.h: Remove base class and add _ustring member.
        * kjs/identifier.cpp: Add null and an == that works with const char *.
        * kjs/property_map.cpp: Get rep through _ustring.

        * kjs/function.cpp: (FunctionImp::parameterString): Call ustring().
        * kjs/function_object.cpp: (FunctionProtoFuncImp::call): Ditto.
        * kjs/nodes.cpp:
        (PropertyNode::evaluate): Ditto.
        (VarDeclNode::evaluate): Ditto.
        (ForInNode::execute): Ditto.
        * kjs/nodes2string.cpp: (SourceStream::operator<<): Add overload for Identifier.
        * kjs/reference.cpp: (Reference::getValue): Call ustring().
        * kjs/regexp_object.cpp: (RegExpObjectImp::get): Call ustring().

WebCore:

	- next step towards atomic identifiers; Identifier is no longer derived from UString

        * khtml/ecma/kjs_binding.cpp:
        (Identifier::string): Added.
        (Identifier::qstring): Added.

        * khtml/ecma/kjs_binding.h:
        * khtml/ecma/kjs_css.cpp:
        (jsNameToProp):
        (DOMCSSStyleDeclaration::tryPut):
        (DOMStyleSheet::tryPut):
        (DOMStyleSheetList::tryGet):
        (DOMMediaList::tryGet):
        (DOMCSSRuleList::tryGet):
        (DOMCSSValueList::tryGet):
        * khtml/ecma/kjs_dom.cpp:
        (DOMNodeList::hasProperty):
        (DOMNodeList::tryGet):
        (DOMNodeListFunc::DOMNodeListFunc):
        (DOMElement::tryGet):
        (DOMNamedNodeMap::hasProperty):
        (DOMNamedNodeMap::tryGet):
        (DOMNamedNodesCollection::tryGet):
        * khtml/ecma/kjs_html.cpp:
        (KJS::HTMLDocument::tryGet):
        (HTMLElementFunction::HTMLElementFunction):
        (KJS::HTMLElement::putValue):
        (KJS::HTMLCollection::hasProperty):
        (KJS::HTMLCollection::tryGet):
        (KJS::HTMLSelectCollection::tryPut):
        (OptionConstructorImp::OptionConstructorImp):
        * khtml/ecma/kjs_navigator.cpp:
        (Plugins::get):
        (MimeTypes::get):
        (Plugin::get):
        * khtml/ecma/kjs_window.cpp:
        (WindowFunc::tryCall):
        (FrameArray::get):
	Use lengthPropertyName instead of "length" for better speed.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fbd4b010
2002-11-19 Darin Adler <darin@apple.com>
- next step towards atomic identifiers; Identifier is no longer derived from UString
* kjs/identifier.h: Remove base class and add _ustring member.
* kjs/identifier.cpp: Add null and an == that works with const char *.
* kjs/property_map.cpp: Get rep through _ustring.
* kjs/function.cpp: (FunctionImp::parameterString): Call ustring().
* kjs/function_object.cpp: (FunctionProtoFuncImp::call): Ditto.
* kjs/nodes.cpp:
(PropertyNode::evaluate): Ditto.
(VarDeclNode::evaluate): Ditto.
(ForInNode::execute): Ditto.
* kjs/nodes2string.cpp: (SourceStream::operator<<): Add overload for Identifier.
* kjs/reference.cpp: (Reference::getValue): Call ustring().
* kjs/regexp_object.cpp: (RegExpObjectImp::get): Call ustring().
2002-11-19 Darin Adler <darin@apple.com>
- fixed memory trasher
......
2002-11-19 Darin Adler <darin@apple.com>
- next step towards atomic identifiers; Identifier is no longer derived from UString
* kjs/identifier.h: Remove base class and add _ustring member.
* kjs/identifier.cpp: Add null and an == that works with const char *.
* kjs/property_map.cpp: Get rep through _ustring.
* kjs/function.cpp: (FunctionImp::parameterString): Call ustring().
* kjs/function_object.cpp: (FunctionProtoFuncImp::call): Ditto.
* kjs/nodes.cpp:
(PropertyNode::evaluate): Ditto.
(VarDeclNode::evaluate): Ditto.
(ForInNode::execute): Ditto.
* kjs/nodes2string.cpp: (SourceStream::operator<<): Add overload for Identifier.
* kjs/reference.cpp: (Reference::getValue): Call ustring().
* kjs/regexp_object.cpp: (RegExpObjectImp::get): Call ustring().
2002-11-19 Darin Adler <darin@apple.com>
- fixed memory trasher
......
2002-11-19 Darin Adler <darin@apple.com>
- next step towards atomic identifiers; Identifier is no longer derived from UString
* kjs/identifier.h: Remove base class and add _ustring member.
* kjs/identifier.cpp: Add null and an == that works with const char *.
* kjs/property_map.cpp: Get rep through _ustring.
* kjs/function.cpp: (FunctionImp::parameterString): Call ustring().
* kjs/function_object.cpp: (FunctionProtoFuncImp::call): Ditto.
* kjs/nodes.cpp:
(PropertyNode::evaluate): Ditto.
(VarDeclNode::evaluate): Ditto.
(ForInNode::execute): Ditto.
* kjs/nodes2string.cpp: (SourceStream::operator<<): Add overload for Identifier.
* kjs/reference.cpp: (Reference::getValue): Call ustring().
* kjs/regexp_object.cpp: (RegExpObjectImp::get): Call ustring().
2002-11-19 Darin Adler <darin@apple.com>
- fixed memory trasher
......
......@@ -173,7 +173,7 @@ UString FunctionImp::parameterString() const
while (*p) {
if (!s.isEmpty())
s += ", ";
s += (*p)->name;
s += (*p)->name.ustring();
p = &(*p)->next;
}
......
......@@ -94,11 +94,11 @@ Value FunctionProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &a
if (thisObj.inherits(&DeclaredFunctionImp::info)) {
DeclaredFunctionImp *fi = static_cast<DeclaredFunctionImp*>
(thisObj.imp());
return String("function " + fi->name() + "(" +
return String("function " + fi->name().ustring() + "(" +
fi->parameterString() + ") " + fi->body->toString());
} else if (thisObj.inherits(&FunctionImp::info) &&
!static_cast<FunctionImp*>(thisObj.imp())->name().isNull()) {
result = String("function " + static_cast<FunctionImp*>(thisObj.imp())->name() + "()");
result = String("function " + static_cast<FunctionImp*>(thisObj.imp())->name().ustring() + "()");
}
else {
result = String("(Internal function)");
......
......@@ -21,3 +21,13 @@
#include "identifier.h"
namespace KJS {
Identifier Identifier::null;
bool operator==(const Identifier &a, const char *b)
{
return a._ustring == b;
}
} // namespace KJS
......@@ -26,12 +26,50 @@
namespace KJS {
class Identifier : public UString {
public:
Identifier() { }
Identifier(const char *s) : UString(s) { }
Identifier(const UString &s) : UString(s) { }
};
class Identifier {
friend class PropertyMap;
public:
Identifier() { }
Identifier(const char *s) : _ustring(s) { }
Identifier(const UString &s) : _ustring(s) { }
const UString &ustring() const { return _ustring; }
DOM::DOMString string() const;
QString qstring() const;
const UChar *data() const { return _ustring.data(); }
int size() const { return _ustring.size(); }
const char *ascii() const { return _ustring.ascii(); }
static Identifier from(unsigned y) { return UString::from(y); }
bool isNull() const { return _ustring.isNull(); }
bool isEmpty() const { return _ustring.isEmpty(); }
unsigned long toULong(bool *ok) const { return _ustring.toULong(ok); }
double toDouble() const { return _ustring.toDouble(); }
static Identifier null;
friend bool operator==(const Identifier &, const Identifier &);
friend bool operator!=(const Identifier &, const Identifier &);
friend bool operator==(const Identifier &, const char *);
private:
UString _ustring;
};
inline bool operator==(const Identifier &a, const Identifier &b)
{
return a._ustring == b._ustring;
}
inline bool operator!=(const Identifier &a, const Identifier &b)
{
return a._ustring != b._ustring;
}
}
......
......@@ -460,8 +460,9 @@ Value PropertyNode::evaluate(ExecState */*exec*/)
if (str.isNull()) {
s = String(UString::from(numeric));
} else
s = String(str);
} else {
s = String(str.ustring());
}
return s;
}
......@@ -1636,7 +1637,7 @@ Value VarDeclNode::evaluate(ExecState *exec)
// "var location" creates a dynamic property instead of activating window.location.
variable.put(exec, ident, val, DontDelete | Internal);
return String(ident);
return String(ident.ustring());
}
void VarDeclNode::processVarDecls(ExecState *exec)
......@@ -2098,7 +2099,7 @@ Completion ForInNode::execute(ExecState *exec)
Reference ref = lexpr->evaluateReference(exec);
KJS_CHECKEXCEPTION
ref.putValue(exec,String(name));
ref.putValue(exec, String(name.ustring()));
c = statement->execute(exec);
if (c.isValueCompletion())
......
......@@ -33,7 +33,9 @@ namespace KJS {
};
UString toString() const { return str; }
SourceStream& operator<<(const KJS::UString &);
SourceStream& operator<<(const Identifier &);
SourceStream& operator<<(const UString &);
SourceStream& operator<<(const char *);
SourceStream& operator<<(char);
SourceStream& operator<<(Format f);
SourceStream& operator<<(const Node *);
......@@ -51,12 +53,24 @@ SourceStream& SourceStream::operator<<(char c)
return *this;
}
SourceStream& SourceStream::operator<<(const KJS::UString &s)
SourceStream& SourceStream::operator<<(const char *s)
{
str += UString(s);
return *this;
}
SourceStream& SourceStream::operator<<(const UString &s)
{
str += s;
return *this;
}
SourceStream& SourceStream::operator<<(const Identifier &s)
{
str += s.ustring();
return *this;
}
SourceStream& SourceStream::operator<<(const Node *n)
{
if (n)
......
......@@ -97,16 +97,16 @@ ValueImp *PropertyMap::get(const Identifier &name, int &attributes) const
{
if (!_table) {
UString::Rep *key = _singleEntry.key;
if (key && keysMatch(name.rep, key)) {
if (key && keysMatch(name._ustring.rep, key)) {
attributes = _singleEntry.attributes;
return _singleEntry.value;
}
return 0;
}
int i = hash(name.rep);
int i = hash(name._ustring.rep);
while (UString::Rep *key = _table[i].key) {
if (keysMatch(name.rep, key)) {
if (keysMatch(name._ustring.rep, key)) {
attributes = _table[i].attributes;
return _table[i].value;
}
......@@ -119,14 +119,14 @@ ValueImp *PropertyMap::get(const Identifier &name) const
{
if (!_table) {
UString::Rep *key = _singleEntry.key;
if (key && keysMatch(name.rep, key))
if (key && keysMatch(name._ustring.rep, key))
return _singleEntry.value;
return 0;
}
int i = hash(name.rep);
int i = hash(name._ustring.rep);
while (UString::Rep *key = _table[i].key) {
if (keysMatch(name.rep, key))
if (keysMatch(name._ustring.rep, key))
return _table[i].value;
i = (i + 1) & _tableSizeHashMask;
}
......@@ -138,13 +138,13 @@ void PropertyMap::put(const Identifier &name, ValueImp *value, int attributes)
if (!_table) {
UString::Rep *key = _singleEntry.key;
if (key) {
if (keysMatch(name.rep, key)) {
if (keysMatch(name._ustring.rep, key)) {
_singleEntry.value = value;
return;
}
} else {
name.rep->ref();
_singleEntry.key = name.rep;
name._ustring.rep->ref();
_singleEntry.key = name._ustring.rep;
_singleEntry.value = value;
_singleEntry.attributes = attributes;
_keyCount = 1;
......@@ -155,9 +155,9 @@ void PropertyMap::put(const Identifier &name, ValueImp *value, int attributes)
if (_keyCount * 2 >= _tableSize)
expand();
int i = hash(name.rep);
int i = hash(name._ustring.rep);
while (UString::Rep *key = _table[i].key) {
if (keysMatch(name.rep, key)) {
if (keysMatch(name._ustring.rep, key)) {
// Put a new value in an existing hash table entry.
_table[i].value = value;
// Attributes are intentionally not updated.
......@@ -167,8 +167,8 @@ void PropertyMap::put(const Identifier &name, ValueImp *value, int attributes)
}
// Create a new hash table entry.
name.rep->ref();
_table[i].key = name.rep;
name._ustring.rep->ref();
_table[i].key = name._ustring.rep;
_table[i].value = value;
_table[i].attributes = attributes;
++_keyCount;
......@@ -215,7 +215,7 @@ void PropertyMap::remove(const Identifier &name)
if (!_table) {
key = _singleEntry.key;
if (key && keysMatch(name.rep, key)) {
if (key && keysMatch(name._ustring.rep, key)) {
key->deref();
_singleEntry.key = 0;
_keyCount = 0;
......@@ -224,9 +224,9 @@ void PropertyMap::remove(const Identifier &name)
}
// Find the thing to remove.
int i = hash(name.rep);
int i = hash(name._ustring.rep);
while ((key = _table[i].key)) {
if (keysMatch(name.rep, key))
if (keysMatch(name._ustring.rep, key))
break;
i = (i + 1) & _tableSizeHashMask;
}
......
......@@ -105,7 +105,7 @@ Value Reference::getValue(ExecState *exec) const
Value o = getBase(exec);
if (o.isNull() || o.type() == NullType) {
UString m = I18N_NOOP("Can't find variable: ") + getPropertyName(exec);
UString m = I18N_NOOP("Can't find variable: ") + getPropertyName(exec).ustring();
Object err = Error::create(exec, ReferenceError, m.ascii());
exec->setException(err);
return err;
......
......@@ -195,10 +195,11 @@ Object RegExpObjectImp::arrayOfMatches(ExecState *exec, const UString &result) c
Value RegExpObjectImp::get(ExecState *exec, const Identifier &p) const
{
if (p[0] == '$' && lastOvector)
UString s = p.ustring();
if (s[0] == '$' && lastOvector)
{
bool ok;
unsigned long i = p.substr(1).toULong(&ok);
unsigned long i = s.substr(1).toULong(&ok);
if (ok)
{
if (i < lastNrSubPatterns + 1)
......
2002-11-19 Darin Adler <darin@apple.com>
- next step towards atomic identifiers; Identifier is no longer derived from UString
* khtml/ecma/kjs_binding.cpp:
(Identifier::string): Added.
(Identifier::qstring): Added.
* khtml/ecma/kjs_binding.h:
* khtml/ecma/kjs_css.cpp:
(jsNameToProp):
(DOMCSSStyleDeclaration::tryPut):
(DOMStyleSheet::tryPut):
(DOMStyleSheetList::tryGet):
(DOMMediaList::tryGet):
(DOMCSSRuleList::tryGet):
(DOMCSSValueList::tryGet):
* khtml/ecma/kjs_dom.cpp:
(DOMNodeList::hasProperty):
(DOMNodeList::tryGet):
(DOMNodeListFunc::DOMNodeListFunc):
(DOMElement::tryGet):
(DOMNamedNodeMap::hasProperty):
(DOMNamedNodeMap::tryGet):
(DOMNamedNodesCollection::tryGet):
* khtml/ecma/kjs_html.cpp:
(KJS::HTMLDocument::tryGet):
(HTMLElementFunction::HTMLElementFunction):
(KJS::HTMLElement::putValue):
(KJS::HTMLCollection::hasProperty):
(KJS::HTMLCollection::tryGet):
(KJS::HTMLSelectCollection::tryPut):
(OptionConstructorImp::OptionConstructorImp):
* khtml/ecma/kjs_navigator.cpp:
(Plugins::get):
(MimeTypes::get):
(Plugin::get):
* khtml/ecma/kjs_window.cpp:
(WindowFunc::tryCall):
(FrameArray::get):
Use lengthPropertyName instead of "length" for better speed.
2002-11-19 David Hyatt <hyatt@apple.com>
Fix backgrounds not painting in deployment builds.
......
2002-11-19 Darin Adler <darin@apple.com>
- next step towards atomic identifiers; Identifier is no longer derived from UString
* khtml/ecma/kjs_binding.cpp:
(Identifier::string): Added.
(Identifier::qstring): Added.
* khtml/ecma/kjs_binding.h:
* khtml/ecma/kjs_css.cpp:
(jsNameToProp):
(DOMCSSStyleDeclaration::tryPut):
(DOMStyleSheet::tryPut):
(DOMStyleSheetList::tryGet):
(DOMMediaList::tryGet):
(DOMCSSRuleList::tryGet):
(DOMCSSValueList::tryGet):
* khtml/ecma/kjs_dom.cpp:
(DOMNodeList::hasProperty):
(DOMNodeList::tryGet):
(DOMNodeListFunc::DOMNodeListFunc):
(DOMElement::tryGet):
(DOMNamedNodeMap::hasProperty):
(DOMNamedNodeMap::tryGet):
(DOMNamedNodesCollection::tryGet):
* khtml/ecma/kjs_html.cpp:
(KJS::HTMLDocument::tryGet):
(HTMLElementFunction::HTMLElementFunction):
(KJS::HTMLElement::putValue):
(KJS::HTMLCollection::hasProperty):
(KJS::HTMLCollection::tryGet):
(KJS::HTMLSelectCollection::tryPut):
(OptionConstructorImp::OptionConstructorImp):
* khtml/ecma/kjs_navigator.cpp:
(Plugins::get):
(MimeTypes::get):
(Plugin::get):
* khtml/ecma/kjs_window.cpp:
(WindowFunc::tryCall):
(FrameArray::get):
Use lengthPropertyName instead of "length" for better speed.
2002-11-19 David Hyatt <hyatt@apple.com>
Fix backgrounds not painting in deployment builds.
......
2002-11-19 Darin Adler <darin@apple.com>
- next step towards atomic identifiers; Identifier is no longer derived from UString
* khtml/ecma/kjs_binding.cpp:
(Identifier::string): Added.
(Identifier::qstring): Added.
* khtml/ecma/kjs_binding.h:
* khtml/ecma/kjs_css.cpp:
(jsNameToProp):
(DOMCSSStyleDeclaration::tryPut):
(DOMStyleSheet::tryPut):
(DOMStyleSheetList::tryGet):
(DOMMediaList::tryGet):
(DOMCSSRuleList::tryGet):
(DOMCSSValueList::tryGet):
* khtml/ecma/kjs_dom.cpp:
(DOMNodeList::hasProperty):
(DOMNodeList::tryGet):
(DOMNodeListFunc::DOMNodeListFunc):
(DOMElement::tryGet):
(DOMNamedNodeMap::hasProperty):
(DOMNamedNodeMap::tryGet):
(DOMNamedNodesCollection::tryGet):
* khtml/ecma/kjs_html.cpp:
(KJS::HTMLDocument::tryGet):
(HTMLElementFunction::HTMLElementFunction):
(KJS::HTMLElement::putValue):
(KJS::HTMLCollection::hasProperty):
(KJS::HTMLCollection::tryGet):
(KJS::HTMLSelectCollection::tryPut):
(OptionConstructorImp::OptionConstructorImp):
* khtml/ecma/kjs_navigator.cpp:
(Plugins::get):
(MimeTypes::get):
(Plugin::get):
* khtml/ecma/kjs_window.cpp:
(WindowFunc::tryCall):
(FrameArray::get):
Use lengthPropertyName instead of "length" for better speed.
2002-11-19 David Hyatt <hyatt@apple.com>
Fix backgrounds not painting in deployment builds.
......
......@@ -233,6 +233,16 @@ QConstString UString::qconststring() const
return QConstString((QChar*) data(), size());
}
DOM::DOMString Identifier::string() const
{
return DOM::DOMString((QChar*) data(), size());
}
QString Identifier::qstring() const
{
return QString((QChar*) data(), size());
}
DOM::Node KJS::toNode(const Value& val)
{
Object obj = Object::dynamicCast(val);
......
......@@ -310,7 +310,7 @@ namespace KJS {
ClassFunc(ExecState *exec, int i, int len) \
: DOMFunction( /*proto? */ ), id(i) { \
Value protect(this); \
put(exec,"length",Number(len),DontDelete|ReadOnly|DontEnum); \
put(exec,lengthPropertyName,Number(len),DontDelete|ReadOnly|DontEnum); \
} \
/** You need to implement that one */ \
virtual Value tryCall(ExecState *exec, Object &thisObj, const List &args); \
......
......@@ -30,7 +30,7 @@
using namespace KJS;
#include <kdebug.h>
static QString jsNameToProp( const UString &p )
static QString jsNameToProp( const Identifier &p )
{
QString prop = p.qstring();
int i = prop.length();
......@@ -312,7 +312,7 @@ Value DOMStyleSheetList::tryGet(ExecState *exec, const Identifier &p) const
#ifdef KJS_VERBOSE
kdDebug(6070) << "DOMStyleSheetList::tryGet " << p.qstring() << endl;
#endif
if (p == "length")
if (p == lengthPropertyName)
return Number(styleSheetList.length());
else if (p == "item")
return lookupOrCreateFunction<DOMStyleSheetListFunc>(exec,p,this,DOMStyleSheetList::Item,1,DontDelete|Function);
......@@ -417,7 +417,7 @@ Value DOMMediaList::tryGet(ExecState *exec, const Identifier &p) const
{
if (p == "mediaText")
return getString(mediaList.mediaText());
else if (p == "length")
else if (p == lengthPropertyName)
return Number(mediaList.length());
bool ok;
......@@ -544,7 +544,7 @@ DOMCSSRuleList::~DOMCSSRuleList()
Value DOMCSSRuleList::tryGet(ExecState *exec, const Identifier &p) const
{
Value result;
if (p == "length")
if (p == lengthPropertyName)
return Number(cssRuleList.length());
else if (p == "item")
return lookupOrCreateFunction<DOMCSSRuleListFunc>(exec,p,this,DOMCSSRuleList::Item,1,DontDelete|Function);
......@@ -1063,7 +1063,7 @@ Value DOMCSSValueList::tryGet(ExecState *exec, const Identifier &p) const
Value result;
DOM::CSSValueList valueList = static_cast<DOM::CSSValueList>(cssValue);
if (p == "length")
if (p == lengthPropertyName)
return Number(valueList.length());
else if (p == "item")
return lookupOrCreateFunction<DOMCSSValueListFunc>(exec,p,this,DOMCSSValueList::Item,1,DontDelete|Function);
......
......@@ -489,7 +489,7 @@ DOMNodeList::~DOMNodeList()
// ## this breaks "for (..in..)" though.
bool DOMNodeList::hasProperty(ExecState *exec, const Identifier &p) const
{
if (p == "length" || p == "item")
if (p == lengthPropertyName || p == "item")
return true;
return ObjectImp::hasProperty(exec, p);
}
......@@ -501,7 +501,7 @@ Value DOMNodeList::tryGet(ExecState *exec, const Identifier &p) const
#endif
Value result;
if (p == "length")
if (p == lengthPropertyName)
result = Number(list.length());
else if (p == "item") {
// No need for a complete hashtable for a single func, but we still want
......@@ -568,7 +568,7 @@ DOMNodeListFunc::DOMNodeListFunc(ExecState *exec, int i, int len)
: DOMFunction(), id(i)
{
Value protect(this);
put(exec,"length",Number(len),DontDelete|ReadOnly|DontEnum);
put(exec,lengthPropertyName,Number(len),DontDelete|ReadOnly|DontEnum);
}
// Not a prototype class currently, but should probably be converted to one
......@@ -1099,14 +1099,14 @@ DOMNamedNodeMap::~DOMNamedNodeMap()
// ## this breaks "for (..in..)" though.
bool DOMNamedNodeMap::hasProperty(ExecState *exec, const Identifier &p) const
{
if (p == "length")
if (p == lengthPropertyName)
return true;
return DOMObject::hasProperty(exec, p);
}
Value DOMNamedNodeMap::tryGet(ExecState* exec, const Identifier &p) const
{
if (p == "length")
if (p == lengthPropertyName)
return Number(map.length());
// array index ?
......@@ -1480,7 +1480,7 @@ DOMNamedNodesCollection::DOMNamedNodesCollection(ExecState *, const QValueList<D
Value DOMNamedNodesCollection::tryGet(ExecState *exec, const Identifier &propertyName) const
{
if (propertyName == "length")
if (propertyName == lengthPropertyName)
return Number(m_nodes.count());
// index?
bool ok;
......
......@@ -208,7 +208,7 @@ Value KJS::HTMLDocument::tryGet(ExecState *exec, const Identifier &propertyName)
// To be implemented. Meanwhile, return an object with a length property set to 0
kdWarning() << "KJS::HTMLDocument document.scripts called - not implemented" << endl;
Object obj( new ObjectImp() );
obj.put( exec, "length", Number(0) );
obj.put( exec, lengthPropertyName, Number(0) );
return obj;
}
case All:
......@@ -1762,7 +1762,7 @@ HTMLElementFunction::HTMLElementFunction(ExecState *exec, int i, int len)
: DOMFunction(), id(i)
{
Value protect(this);
put(exec,"length",Number(len),DontDelete|ReadOnly|DontEnum);
put(exec,lengthPropertyName,Number(len),DontDelete|ReadOnly|DontEnum);
}
Value KJS::HTMLElementFunction::tryCall(ExecState *exec, Object &thisObj, const List &args)
......@@ -2078,7 +2078,7 @@ void KJS::HTMLElement::putValue(ExecState *exec, int token, const Value& value,
case SelectLength: { // read-only according to the NS spec, but webpages need it writeable
Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.options(), select) );