Skip to content

Commit

Permalink
Replace var with const (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
rami-elementor authored Mar 17, 2024
1 parent 116560e commit 118f062
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/controls/complex-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ class Elementor_EmojiOneArea_Control extends \Elementor\Base_Data_Control {
```js
window.addEventListener( 'elementor/init', () => {

var emojioneareaItemView = elementor.modules.controls.BaseData.extend({
const emojioneareaItemView = elementor.modules.controls.BaseData.extend({
onReady() {
var self = this,
const self = this,
options = _.extend({
events: {
change: () => self.saveValue(),
Expand Down
6 changes: 5 additions & 1 deletion src/editor-controls/control-hover-animation.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ class Elementor_Test_Widget extends \Elementor\Widget_Base {
$settings = $this->get_settings_for_display();

$elementClass = 'container';

if ( $settings['hover_animation'] ) {
$elementClass .= ' elementor-animation-' . $settings['hover_animation'];
}

$this->add_render_attribute( 'wrapper', 'class', $elementClass );
?>
<div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>>
Expand All @@ -117,10 +119,12 @@ class Elementor_Test_Widget extends \Elementor\Widget_Base {
protected function content_template() {
?>
<#
var elementClass = 'container';
const elementClass = 'container';

if ( '' !== settings.hover_animation ) {
elementClass += ' elementor-animation-' + settings.hover_animation;
}

view.addRenderAttribute( 'wrapper', { 'class': elementClass } );
#>
<div {{{ view.getRenderAttributeString( 'wrapper' ) }}}>
Expand Down
2 changes: 1 addition & 1 deletion src/editor-controls/control-icons.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class Icons_Elementor_Test_Control_Widget extends \Elementor\Widget_Base {
protected function content_template() {
?>
<#
var iconHTML = elementor.helpers.renderIcon( view, settings.selected_icon, { 'aria-hidden': true }, 'i' , 'object' );
const iconHTML = elementor.helpers.renderIcon( view, settings.selected_icon, { 'aria-hidden': true }, 'i' , 'object' );
#>
<div class="my-icon-wrapper">
{{{ iconHTML.value }}}
Expand Down
4 changes: 2 additions & 2 deletions src/editor-controls/group-control-image-size.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ class Elementor_Test_Widget extends \Elementor\Widget_Base {
protected function content_template() {
?>
<#
var image = {
const image = {
id: settings.image.id,
url: settings.image.url,
size: settings.thumbnail_size,
dimension: settings.thumbnail_custom_dimension,
model: view.getEditModel()
};
var image_url = elementor.imagesManager.getImageUrl( image );
const image_url = elementor.imagesManager.getImageUrl( image );
#>
<img src="{{{ image_url }}}" />
<?php
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/advanced-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,12 @@ class Elementor_List_Widget extends \Elementor\Widget_Base {
#>
<{{{ html_tag[ settings.marker_type ] }}} {{{ view.getRenderAttributeString( 'list' ) }}}>
<# _.each( settings.list_items, function( item, index ) {
var repeater_setting_key = view.getRepeaterSettingKey( 'text', 'list_items', index );
const repeater_setting_key = view.getRepeaterSettingKey( 'text', 'list_items', index );
view.addRenderAttribute( repeater_setting_key, 'class', 'elementor-list-widget-text' );
view.addInlineEditingAttributes( repeater_setting_key );
#>
<li {{{ view.getRenderAttributeString( repeater_setting_key ) }}}>
<# var title = item.text; #>
<# const title = item.text; #>
<# if ( item.link ) { #>
<# view.addRenderAttribute( `link_${index}`, item.link ); #>
<a href="{{ item.link.url }}" {{{ view.getRenderAttributeString( `link_${index}` ) }}}>
Expand Down

0 comments on commit 118f062

Please sign in to comment.