In HTML, most attributes have two faces: the content attribute and the IDL attribute.
The content attribute is the attribute as you set it from the content (the HTML code) and you can set it or get it via element.setAttribute() or element.getAttribute(). The content attribute is always a string even when the expected value should be an integer. For example, to set an element's maxlength to 42 using the content attribute, you have to call setAttribute("maxlength", "42") on that element.
The IDL attribute is also known as a JavaScript property. These are
the attributes you can read or set using JavaScript properties like element.foo.
The IDL attribute is always going to use (but might transform) the
underlying content attribute to return a value when you get it and is
going to save something in the content attribute when you set it. In
other words, the IDL attributes, in essence, reflect the content
attributes.
Most of the time, IDL attributes will return their valules as they are really used. For example, the default type for elements is "text", so if you set input.type="foobar", the
element will be of type text (in the appearance and the behavior) but
the "type" content attribute's value will be "foobar". However, the type IDL attribute will return the string "text".
IDL attributes are not always strings; for example, input.maxlength is a number (a signed long). When using IDL attributes, you read or set values of the desired type, so input.maxlength is always going to return a number and when you set input.maxlength
,it wants a number. If you pass another type, it is automatically
converted to a number as specified by the standard JavaScript rules for
type conversion.
IDL attributes can reflect other types
such as unsigned long, URLs, booleans, etc. Unfortunately, there are no
clear rules and the way IDL attributes behave in conjunction with their
corresponding content attributes depends on the attribute. Most of the
time, it will follow the rules laid out in the specification,
but sometimes it doesn't. HTML specifications try to make this as
developer-friendly as possible, but for various reasons (mostly
historical), some attributes behave oddly (select.size, for example) and you should read the specifications to understand how exactly they behave.
“ মা হল পৃথিবীর একমাত্র ব্যাংক, যেখানে আমরা আমাদের সব দুঃখ, কষ্ট জমা রাখি এবং বিনিময়ে নেই বিনাসূদে অকৃত্রিম ভালোবাসা ”
হুমায়ূন আহমেদ
বিখ্যাত মনিষীদের স্বরণীয় কিছু উক্তি
বুদ্ধিমানেরা কোনোকিছু প্রথমে অন্তর দিয়ে অনুভব করে, তারপর সে সম্বন্ধে মন্তব্য করে । আর নির্বোধেরা প্রথমেই মন্তব্য করে বসে এবং পরে চিন্তা করে । -হযরত আলী (রাঃ)"
সত্য একবার বলতে হয়; সত্য বারবার বললে মিথ্যার মতো শোনায়। মিথ্যা বারবার বলতে হয়; মিথ্যা বারবার বললে সত্য ৰলে মনে হয়।
“প্রত্যেককে বিশ্বাস করা বিপদজনক, কিন্তু কাউকে বিশ্বাস না করা আরো বেশী বিপদজনক”
এই পৃথিবী কখনো খারাপ মানুষের খারাপ কর্মের জন্য ধ্বংস হবে না , যারা খারাপ মানুষের খারাপ কর্ম দেখেও কিছু করেনা তাদের জন্যই পৃথিবী ধ্বংস হবে” আইনস্টাইন
একজন আহত ব্যক্তি তার যন্ত্রনা যত সহজে ভুলে যায়, একজন অপমানিত ব্যক্তি তত সহজে অপমান ভোলে না -জর্জ লিললো
0 মন্তব্য(গুলি):
Post a Comment