الفرق بين المراجعتين ل"Sass/global variable exists"

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
(أنشأ الصفحة ب'<noinclude>{{DISPLAYTITLE: الدالة <code>()variable_exists</code> في Sass}}</noinclude> تحدّد الدالة <code>variable_exists()‎</code> ما إذا ك...')
 
سطر 1: سطر 1:
 
<noinclude>{{DISPLAYTITLE: الدالة <code>()variable_exists</code> في Sass}}</noinclude>
 
<noinclude>{{DISPLAYTITLE: الدالة <code>()variable_exists</code> في Sass}}</noinclude>
تحدّد الدالة <code>variable_exists()‎</code>  ما إذا كانت ميزة معينةٌ موجودةٌ في وقت تشغيل <code>[[Sass]]</code>.
+
تحدّد الدالة <code>variable_exists()‎</code>  ما إذا كان متغير ما موجود في النطاق الحالي ( current scope) أو في النطاق العام (global scope).
 
 
الميزات التالية مدعومة:
 
* <code>global-variable-shadowing</code>: تشير إلى أنّ متغيرًا محليًا سيحجب متغيراً عامًّا ما لم تُستخدم <code>‎!global</code>.
 
 
 
* <code>extend-selector-pseudoclass</code>: تشير إلى أنّ ‎<code>@extend</code> ستصل إلى أشباه الأصناف (pseudoclasses) مثل <code>‎:not</code>.
 
 
 
* <code>units-level-3</code>: تشير إلى الدعم الكامل لحسابيات الوحدات (unit arithmetic) باستخدام الوحدات المُعرّفة في مواصفات [[http://www.w3.org/TR/css3-values القيم والوحدات 3]].
 
 
 
* <code>at-error</code>: تشير إلى أنّ المُوجّه ‎<code>@error</code> مدعوم.
 
 
 
* <code>custom-property</code>: تشير إلى أن مواصفات [ا[https://www.w3.org/TR/css-variables-1 لخاصيات المُخصّصة المستوى 1]] مدعومة. وهذا يعني أن الخاصيات المُخصّصة تُحلّل بشكل ثابت (parsed statically)، مع معالجة الاستيفاء مثل <code>[[SassScript]]</code>.
 
  
 
== البنية العامة ==
 
== البنية العامة ==
 
<syntaxhighlight lang="sass">
 
<syntaxhighlight lang="sass">
variable_exists($feature)
+
variable_exists($name)
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== المعاملات ==
 
== المعاملات ==
  
=== <code>‎$feature</code> ===
+
=== <code>‎$name</code> ===
اسم الميزة.
+
اسم المتغير الذي نتحقق منه. لا ينبغي أن يتضمن الإسمُ  البادئةَ <code>$</code>.
  
 
== القيم المعادة ==
 
== القيم المعادة ==
قيمة منطقية تحدد ما إذا كانت الميزة مدعومة في النسخة الحالية للغة <code>[[Sass]]</code>.
+
قيمة منطقية تحدد ما إذا كان المتغير مُعرّفًا في النطاق الحالي.
 
 
== الأخطاء والاستثناءات ==
 
سيُرمى الخطأ <code>ArgumentError</code> إن لم يكن <code>‎$feature</code>سلسلة نصيةً.
 
  
 
==  أمثلة ==
 
==  أمثلة ==
 
مثال عن استخدام الدالة <code>variable_exists()‎</code>:<syntaxhighlight lang="sass">
 
مثال عن استخدام الدالة <code>variable_exists()‎</code>:<syntaxhighlight lang="sass">
feature-exists(some-feature-that-exists) // true
+
$a-false-value: false;
feature-exists(what-is-this-i-dont-know) // false
+
variable-exists(a-false-value) // true
 +
variable-exists(a-null-value) // true
 +
 
 +
variable-exists(nonexistent) // false
 
</syntaxhighlight>
 
</syntaxhighlight>
  
سطر 38: سطر 27:
 
* الدالة <code>[[Sass/function exists|function_exists()]]</code>‎: تحدد ما إذا كانت دالة ما موجودة.
 
* الدالة <code>[[Sass/function exists|function_exists()]]</code>‎: تحدد ما إذا كانت دالة ما موجودة.
 
* الدالة <code>[[Sass/global variable exists|global_variable_exists()]]</code>‎: تحدد ما إذا كان متغير ما موجود في النطاق العام.
 
* الدالة <code>[[Sass/global variable exists|global_variable_exists()]]</code>‎: تحدد ما إذا كان متغير ما موجود في النطاق العام.
* الدالة <code>[[Sass/variable exists|variable_exists()]]</code>‎: تحدد ما إذا كان متغير ما موجود في النطاق الحالي.
+
* الدالة <code>[[Sass/feature exists|feature_exists()]]</code>‎: تحدد ما إذا كانت ميزة معينةٌ موجودةٌ في وقت تشغيل <code>[[Sass]]</code>.
 
* الدالة <code>[[Sass/mixin exists|mixin_exists()]]</code>‎: تحدد ما إذا كان مخلوط ما موجودًا.
 
* الدالة <code>[[Sass/mixin exists|mixin_exists()]]</code>‎: تحدد ما إذا كان مخلوط ما موجودًا.
  

مراجعة 11:40، 22 أبريل 2018

تحدّد الدالة variable_exists()‎ ما إذا كان متغير ما موجود في النطاق الحالي ( current scope) أو في النطاق العام (global scope).

البنية العامة

variable_exists($name)

المعاملات

‎$name

اسم المتغير الذي نتحقق منه. لا ينبغي أن يتضمن الإسمُ البادئةَ $.

القيم المعادة

قيمة منطقية تحدد ما إذا كان المتغير مُعرّفًا في النطاق الحالي.

أمثلة

مثال عن استخدام الدالة variable_exists()‎:

$a-false-value: false;
variable-exists(a-false-value) // true
variable-exists(a-null-value) // true

variable-exists(nonexistent) // false

انظر أيضًا

  • الدالة function_exists()‎: تحدد ما إذا كانت دالة ما موجودة.
  • الدالة global_variable_exists()‎: تحدد ما إذا كان متغير ما موجود في النطاق العام.
  • الدالة feature_exists()‎: تحدد ما إذا كانت ميزة معينةٌ موجودةٌ في وقت تشغيل Sass.
  • الدالة mixin_exists()‎: تحدد ما إذا كان مخلوط ما موجودًا.

مصادر