lindelwa122 / dom-wizard

JavaScript library that makes DOM manipulation easy and more managable.
MIT License
7 stars 8 forks source link

domManager.read #2

Open lindelwa122 opened 9 months ago

lindelwa122 commented 9 months ago

domManager.read

domManager

The domManager module is responsible for creating, updating, reading, and deleting DOM elements.

read()

The read() function is responsible for retrieving data from a specific element.

Parameters/Inputs:

The function should accept three parameters: selector, attributeName (optional), and all (optional).

The function will utilize querySelector(selector) to retrieve the element. If this returns undefined, the function should throw an error. Subsequently, it should return the value of the requested attribute. If the attributeName is not a qualified name, an error should be thrown. If attributeName is not specified, the function should return the element as is. By default, all is set to false, but if the user sets all to true, the function should use querySelectorAll(selector) instead. If all is true and attributeName is specified, the function should return an array containing the values of that attributeName. For example, if the user invokes domManager.read(".content", "dataset", true), the function should return an array of datasets for elements with a class name of .content. However, if attributeName is not specified and all is set to true, the function should return a NodeList or an array containing all elements with the specified selector.

sinster2003 commented 9 months ago

Hi @lindelwa122 , I stumbled upon your repository while searching for some Hacktoberfest projects. I found it genuinely interesting, and I'm currently working on implementing the read functionality for DOM elements and their attributes. I would love to contribute.

Screenshot (6) Screenshot (7) Screenshot (8)

sinster2003 commented 9 months ago

Hey @lindelwa122 , as an update I have worked a little on the read DOM feature I have almost completed it ... yet to rigorously test it and document it ... I will proceed with a pull request soon

lindelwa122 commented 9 months ago

Thank you, @sinster2003, for your contribution. I've assigned the feature to you.

sinster2003 commented 9 months ago

Hey @lindelwa122, have made a pull request do review it

sinster2003 commented 9 months ago

@lindelwa122 , I created the read function in a new branch and directly made the changes in index.js starter file where you had written the previous code.. do you want me to change the location to template src folder or anywhere else do mention if needed I will make the changes.

sinster2003 commented 9 months ago

@lindelwa122 , I created the read function in a new branch and directly made the changes in index.js starter file where you had written the previous code.. do you want me to change the location to template src folder or anywhere else do mention if needed I will make the changes.

lindelwa122 commented 9 months ago

It's okay, it should be in index.js.